Problems with Phusion Passenger Sub URI alias symbology

I am deploying an application under URI rails on Ubuntu with Apache and Phusion Passenger on

www.mydomain.com/suburi 

and I have setup problems. I am getting this error now:

 Passenger Error #2 An error occurred while trying to access '/srv/www/mydomain/public/suburi': Cannot resolve possible symlink '/srv/www/mydomain/public/suburi': No such file or directory (2) 

Both the rails application for mydomain.com and the rails application for mydomain.com/suburi are located in / srv / www /

My current virtual host is as follows:

 <VirtualHost 173.230.137.212:80> ServerName www.mydomain.com ServerAlias mydomain.com DocumentRoot /srv/www/mydomain/public ErrorLog /srv/www/error.log RewriteEngine On RewriteOptions Inherit RailsEnv production <directory /srv/www/mydomain/public> Options Indexes FollowSymLinks -MultiViews AllowOverride all Order allow,deny allow from all </directory> RailsBaseURI /suburi <Directory /srv/www/suburi> Options -MultiViews </Directory> 

I know the paths are true, but the only thing I know is true. My server administration skills are not surprising.

I made a symbolic link from the mydomain.com public folder to the sub uri public folder. Not sure if I did it right, I found that the documentation is not so great. Is there something that I am missing and / or doing wrong? Did I make the wrong system link?

I would really appreciate help.

Or, if so, if someone knows a better / easier way to do this with a subdomain, for example subdomain.mywebsite.com, which will work too.

thanks

+4
source share
1 answer

If you use Suburi, then

  • <documentroot>/<suburi> is for specifying the public directory of your rails application
  • your rails root directory for applications should be one directory above your rails declaration.

Both are solved if you have a dedicated public docroot for your domain, and then you do

 ln -sf /path/to/suburi-rails-app/public <documentroot>/<suburi> 

The documentation is really not that great. So your solution would be:

 ln -sf /srv/www/suburi/public srv/www/mydomain/public/suburi 

and vhost conf:

 <VirtualHost 173.230.137.212:80> ServerName www.mydomain.com ServerAlias mydomain.com DocumentRoot /srv/www/mydomain/public ErrorLog /srv/www/error.log RewriteEngine On RewriteOptions Inherit RailsEnv production <Directory /srv/www/mydomain/public> Options FollowSymLinks -MultiViews AllowOverride all Order allow,deny Allow from all </Directory> RailsBaseURI /suburi <Directory /srv/www/mydomain/public/suburi> Options -MultiViews </Directory> </VirtualHost> 

you say that: both the rails app for mydomain.com and the rails app for mydomain.com/suburi are in / srv / www /

This confused me a bit, I don’t think that it would be nice to run the application in the domain, and the other in suburi, since routing should be confusing. Rather use 2 suburi, in this case

 ln -sf /srv/www/suburi2/public srv/www/mydomain/public/suburi2 

where / srv / www / suburi2 is your second application root directory and add:

 RailsBaseURI /suburi2 <Directory /srv/www/mydomain/public/suburi2> Options -MultiViews </Directory> 

you can add any number of suburis to the same vhost.

hope this helped

+2
source

All Articles