apache - Why does a Rails Application run properly from a port but not from a subdomain? -
here content of /etc/apache2/sites-available/default file
namevirtualhost *:80 <virtualhost *:80> servername domain.com # !!! sure point documentroot ('public')! documentroot /var/www </virtualhost> <virtualhost *:80> servername a.domain.com # !!! sure point documentroot ('public')! documentroot /home/user/a/public <directory /home/user/a/public> allowoverride options -multiviews </directory> </virtualhost> <virtualhost *:80> servername b.domain.com # !!! sure point documentroot ('public')! documentroot /home/user/b/public <directory /home/user/b/public> allowoverride options -multiviews </directory> </virtualhost> <virtualhost *:80> servername c.domain.com # !!! sure point documentroot ('public')! documentroot /home/user/c <directory /home/user/c/public> allowoverride options -multiviews </directory> </virtualhost>
the intention "link" subdomain names (such a.domain.com) rails application running on specific port (with multiple low intensity rails application on same server). configuration shown above works redirect appropriate static page and/or rails application, except 1 of them has problem:
the problematic rails application runs when accessed via: domain.com:port (or domain.com:4444 )
however when attempts access same rails application via: c.domain.com (subdomain linked directory rails app lives) throws error:
https://github.com/net-ssh/net-ssh (at master) not yet checked out. run `bundle install` first. (bundler::giterror)
to clear, same rails application works when accessed domain.com:port fails c.domain.com
since 1 of rails applications in collection works , fails, find puzzling. far cannot find in searches.
questions , suggestions welcome.
thank you, ~ allen
news: i'm still reading documentation in attempt understand why accessing rails application port or sub domain (domainname.com:port .vs. sub.domainname.com) behaves differently. however, did determine making apache owner of directory structure helped access sub domain working. (apache user = www-data )
chown -r www-data:www-data /home/user/app
resolved issue 1 of rails apps. there .htaccess file in public directory had removed , need use version of bundle command:
bundle install --path vendor/bundle
that not needed other application running on sub domain.
it seems have technically solved puzzle, still don't understand why necessary 1 application , not another.
are document roots symlinks same rails_root directory? or there copy of app in each of document roots?
Comments
Post a Comment