开发者

Running rails app from a subDir on Apache with Passenger

I've already spent a few hours thoroughly trying to find an answer. The guys from Site5 who provide the hosting hit a wall.

What I'm trying to do: Run the reils app from playplanit[dot]com/sfcal and not from playplanit[dot]com/.

The current setup: - The app itself is here: /home/playplan/apps/ppi/current/ - In .htaccess file PassengerEnabled on PassengerAppRoot /home/playplan/apps/ppi/current - The public files are in the public_html (previously the were here /home/playplan/apps/ppi/current/public and public_html was a sym link, but I changed that because the whole point of making this change is so that I can run a Wordpress blog in the docRoot

What has been tried: - Creating a sym link: sfcal/ -> /home/playplan/apps/ppi/current/public - Adding RailsBaseURI /sfcal to .htaccess file - Attempting to change all 'paths' in routes.rb Here's the rake routes output after paths I could think to change where changed: http://cl.ly/2N2Q2z0N332v2B2F3r38 - I thought that maybe map.root need to be changed somehow, but couldn't and then one of the technicians helping me added this line to environment.rb: config.action_controller.relative_url_root = "/sfcal" - Accoring to them nothing needs to be change in the httpd.conf file - I've also tried restarting the app by creating a restart.txt file in tmp/

I know that the sym link works, but something in the app recognizes that it's a subDir and will serve开发者_JAVA百科 up a 404 that sits in the 'public' dir.

Any ideas of what else needs configuring?

Thanks!


Check Passenger documentation Deploying to a sub URI.

EDIT

All you need is to follow Passenger documentation. Your needn't mess with rails routes or move you application public folder.

Suppose you have you rails app deployed to /home/playplan/apps/ppi/current and /home/playplan/public_html directory is root of your virtual host with following Apache configuration:

<VirtualHost *:80>
  ServerName playplanit.com
  DocumentRoot /home/playplan/public_html
  <Directory /home/playplan/public_html>
    Allow from all
  </Directory>
</VirtualHost>

To have your application accessible from http://playplanit.com/sfcal your need to do following:

  • Make sure that Apache Options FollowSymLinks and AllowOverride Options is enabled in httpd.conf for your VirtualHost or following won't work.

  • Create link named as sfcal in public_html directory pointing to your rails public directory.

ln -s /home/playplan/apps/ppi/current/public /home/playplan/public_html/sfcal

  • Add following to /home/playplan/public_html/.htaccess

    RailsBaseURI /sfcal
    
  • Place following into /home/playplan/public_html/sfcal/.htaccess

    Options -MultiViews
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜