我需要一些帮助,以获取在cPanel配置的Apache站点的子uri中工作的Rails 3.2应用程序。我遵循Passenger文档和各种博客帖子中的步骤。根操作呈现正常,但每隔一个请求给我一个404.使用Apache 2,Rails 3.2和Phusion Passenger配置子uri时遇到问题
我认为这是在Apache中,而不是Rails,配置,因为它不是Rails应用程序的404页面,并且404不会留下痕迹Rails日志。
下面是httpd.conf中的虚拟主机部分,通过的cPanel产生:
<VirtualHost myip:443>
ServerName mysite.org
ServerAlias www.mysite.org
DocumentRoot /home/myuser/public_html
ServerAdmin [email protected]
UseCanonicalName Off
Options -ExecCGI -Includes
RemoveHandler cgi-script .cgi .pl .plx .ppl .perl
CustomLog /usr/local/apache/domlogs/mysite.org combined
CustomLog /usr/local/apache/domlogs/mysite.org-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User myuser # Needed for CPanel::ApacheConf
UserDir disabled
UserDir enabled myuser
<IfModule mod_suphp.c>
suPHP_UserGroup myuser myuser
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup myuser myuser
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid myuser myuser
</IfModule>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/mysite.org.crt
SSLCertificateKeyFile /etc/ssl/private/mysite.org.key
SSLCACertificateFile /etc/ssl/certs/mysite.org.cabundle
CustomLog /usr/local/apache/domlogs/mysite.org-ssl_log combined
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
<Directory "/home/myuser/public_html/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
Include "/usr/local/apache/conf/userdata/ssl/2/myuser/mysite.org/*.conf"
</VirtualHost>
这里是包含文件的最新版本,我把共同为子URI:
RewriteEngine On
RewriteOptions Inherit
RailsEnv production
<Directory /home/myuser/public_html>
Options Indexes FollowSymLinks -MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
RackBaseURI /home/myrailsapp/current
<Directory /home/myuser/public_html/railsapp>
Options -MultiViews
</Directory>
/home/myuser/public_html/railsapp是/ home/myrailsapp/current/public的符号链接
这里是/home/myrailsapp/current/public/.htaccess
RackBaseURI /railsapp
SetEnv GEM_HOME /usr/local/lib/ruby/gems
PassengerEnabled On
PassengerAppRoot /home/myrailsapp/current/
/home/myrailsapp和/ home/mysite中的所有文件都属于myuser。 (我没有看到任何权限错误。)
在我的路线文件:
resources :widgets
root :to => 'widgets#index'
当我浏览到https://mysite.org/railsapp它正确地显示小工具的索引,包括资产。当我去https://mysite.org/railsapp/widgets或https://mysite.org/railsapp/widgets/index时,我得到了Apache 404,并且Rails日志中没有条目。
我错过了什么?