开发者

Configuring a migrated Rails app - how to convince Apache to point to my app?

How do I get Apache to point to the Rails app? I have my Rails app in /var/www and I successfully installed Passenger, Ruby, Rails, MySQL. This is a new server and I'm just trying to move an existing production Rails app to it. I thought it might be something in httpd.conf but there's no reference to the app in the running server's conf.

Update

I already had my httpd.conf updated with the Passenger lines:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/local/bin/ruby

Also, I have a vhosts file which is identical to the开发者_如何学Go original:

<VirtualHost *:80>
   ServerAdmin admin@ourdomain.com
   DocumentRoot /var/www/tutorials/public
   ServerName tutorials.ourdomain.local
   ErrorLog logs/tutorials_error.log
   CustomLog logs/tutorials_access.log common
</VirtualHost>

Update 2

I found that I can stop serving the default Apache page by commenting out all lines of welcome.conf. Now I get the 403 forbidden page "you don't have permission to access / on this server" Even though I chmod 777'd the app directory and its contents (and /var/www).

Update 3

I found I can access the default Rails page by going to [ipaddress]/findex.html.


You have to edit your Apache configuration file like this:

LoadModule passenger_module /somewhere/passenger-x.x.x/ext/apache2/mod_passenger.so

PassengerRuby /usr/bin/ruby
PassengerRoot /somewhere/passenger/x.x.x
PassengerMaxPoolSize 10


<VirtualHost *:80>
    ServerName www.myapp.com
    DocumentRoot /www/myapp/public
    <Directory /www/myapp/public>
        Allow from all
    </Directory>
</VirtualHost>

More on the Phusion Passenger users guide for Apache.


SELinux was the culprit. Setenforce 0, service httpd restart proved this fact.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜