Setting up Rails app on Apache with passenger - Rails doesn't seem to load

半世苍凉 提交于 2019-11-28 18:27:30

Deploying a Ruby on Rails application

Suppose you have a Ruby on Rails application in /webapps/mycook, and you own the domain www.mycook.com. You can either deploy your application to the virtual host’s root (i.e. the application will be accessible from the root URL, http://www.mycook.com/), or in a sub URI (i.e. the application will be accessible from a sub URL, such as http://www.mycook.com/railsapplication).

Deploying to a virtual host’s root

Add a virtual host entry to your Apache configuration file. Make sure that the following conditions are met:

  • The virtual host’s document root must point to your Ruby on Rails application’s public folder.
  • The Apache per-directory permissions must allow access to this folder.
  • MultiViews must be disabled for this folder.

For example:

<VirtualHost *:80>
    ServerName www.mycook.com
    DocumentRoot /webapps/mycook/public
    <Directory /webapps/mycook/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

You may also need to tweak your file/folder permissions. Make sure that the following folders are readable and executable by Apache:

  • this public folder.
  • the application’s config folder.
  • all parent folders. That is, /webapps/mycook and /webapps must also be readable and executable by Apache.

Then restart Apache. The application has now been deployed.

Read the whole docs here

Double check to make sure passenger is loading your application by typing sudo passenger-status

This will show you an error if passenger isn't loaded or the below if it is. Note the part where it shows you which application or applications it has loaded and what the current uptime is:

----------- General information -----------
max      = 6
count    = 1
active   = 0
inactive = 1
Waiting on global queue: 0
----------- Application groups -----------
/home/rourkem/public_html/evecord.com/current:
  App root: /home/rourkem/public_html/evecord.com/current
  * PID: 18976   Sessions: 0    Processed: 5       Uptime: 23m 55s

Be sure to delete the file index.html from the public directory of your application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!