Setting up sub uri with rails3, passenger, Ubuntu 10.10

Hello all, I want to set up a separate rails application as a sub URI, i.e. I have a main app running at www.mydomain.com and want a separate rails app at www.mydomain.com/suburi

Right now I'm using passenger, rails3 and Ubuntu 10.10. I have the main app up and running fine. When trying to upload the app and set it to the sub URI I followed [http://www.modrails.com/documentation/Users%20guide%20Apache.html#deployingrailstosuburi" target="blank">](http://www.modrails.com/documentation/U … to_sub_uri">http://www.modrails.com/documentation/Users%20guide%20Apache.html#deployingrailstosuburi]( and this guide as well: [http://www.wdvl.com/Authoring/ror/Passenger/saurabhbhatia04142010.html" target="blank">](http://www.wdvl.com/Authoring/ror/Passe … 42010.html">http://www.wdvl.com/Authoring/ror/Passenger/saurabhbhatia04142010.html](.

Both my websites reside in /srv/www

This is what my virtual host looks like

 <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></virtualhost> 

I went into /srv/www/mydomain/public and created a sym link like so:

ln -s /srv/www/mydomain/public /srv/www/mydomain

and same for my sub uri app

ln -s /srv/www/suburi/public /srv/www/suburi

However, I'm not sure if I'm doing the sym links right, I did what they said it the tutorials and on the passenger page but I felt like documentation wasn't that clear on them.

Also, I uploaded the app as root and haven't changed any permissions. I'm not sure what the permissions need to be set to because I'm not sure what permissions apache needs for it to be able to run the app.

And finally, the error I'm getting looks like this:

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)

currently I have only one vhost file for both the main domain and suburi, like it said in the documentation (at least I think, also didn't seem to clear).

In the vhosts file I also tried setting the paths with the /public part removed from the /srv/www/mydomain like so:

 <virtualhost 173.230.137.212:80="">ServerName www.mydomain.com
  ServerAlias mydomain.com
  DocumentRoot /srv/www/mydomain     ## NOTE: removed /public
  ErrorLog /srv/www/error.log
  RewriteEngine On
  RewriteOptions Inherit
  RailsEnv production

 <directory srv="" www="" mydomain="">## NOTE: removed /public
  Options Indexes FollowSymLinks -MultiViews
  AllowOverride all
  Order allow,deny 
  allow from all</directory> 

RailsBaseURI /suburi                   
 <directory srv="" www="" suburi="">Options -MultiViews</directory></virtualhost> 

But the suburi still wouldn't work and when I visited the main app it showed my directory structure for mydomain.com which obviously is no good.

And one last thing I tried was putting /public in the vhosts for the suburi, which almost appeared to work cause it gave me the rails error "The page you are looking for doesn't exist. You may have mistyped the address or the page may have moved."

I have been struggling on this forever, help would be so very much appreciated since I need this for a class project. Thanks!

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct