I've already installed the needed tools, and followed several tutorials trying to make passenger respond.
我已经安装了所需的工具,并遵循了一些教程,试图让乘客做出响应。
I can access static files in public folder (public/500.html or 422.hml). Yesterday I entered through a vhost, and found some passenger errors. But some time later the hosting restarted the service, and since then I have not been able to access the rails app again.
我可以访问公用文件夹中的静态文件(public/500)。422. html或xml)。昨天我通过一个vhost,发现了一些乘客的错误。但过了一段时间,主机重新启动了服务,从那以后,我就再也无法访问rails应用了。
链接
链接
链接
These are some of the links I used to configure the server. I've also read that could be a permission issue; I've checked that, but I'm not sure it's fine.
这些是我用来配置服务器的一些链接。我也读过这可能是一个许可问题;我检查过了,但我不确定是否可以。
4 个解决方案
#1
15
First of all check your error log. By default, it placed at /var/log/apache2/
.
首先检查您的错误日志。默认情况下,它位于/var/log/apache2/。
If you have client denied by server configuration
issue, check your site conf file at /etc/apache2/sites-available/your-site.conf
. It must be in compliance with Phusion Passenger User Guide. Take a look on Require all granted
.
如果您的客户端被服务器配置问题拒绝,请在/etc/apache2/site .conf中检查您的站点conf文件。它必须符合Phusion乘客用户指南。看一看要求都是理所当然的。
<Directory "/home/user/folder">
Require all granted
Options FollowSymLinks
# This relaxes Apache security settings.
AllowOverride None
# MultiViews must be turned off.
Order allow,deny
Allow from all
</Directory>
#2
4
OK for me this meant I was running rails 2.3 and using Phusion Passenger 5.x
对我来说,这意味着我在运行rails 2.3和使用Phusion乘客5。x。
Apparently 5.x doesn't work with 2.2 at all, and requires 2.3 for you to copy in a config.ru file so that it uses rack for the backend.
显然是5。x与2.2根本不兼容,并且需要2.3让您在config.ru文件中复制,以便后端使用机架。
example config.ru file for 2.3:
示例config.ru文件2.3:
# Rack Dispatcher
# Require your environment file to bootstrap Rails
require File.dirname(__FILE__) + '/config/environment'
# Dispatch the request
run ActionController::Dispatcher.new
I could not figure out why no incantations seemed to work, it was like Passenger was ignoring my rails app.
我搞不懂为什么没有咒语管用,就像乘客无视我的rails应用。
In my /var/log/apache2/error.log file, I had this:
在我/var/log/apache2/error.日志文件,我有这个:
[Mon May 11 15:47:00.397891 2015] [autoindex:error] [pid 17490:tid 3058694976] [client 216.49.181.251:49248] AH01276: Cannot serve directory /home/x/y/railsapp/public/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive, referer: https://www.google.com/
[[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref
Which confused the heck out of me an apparently meant "passenger isn't running on that virtual host".
让我感到困惑的是,显然这意味着“乘客并没有在虚拟主机上运行”。
If I created a public/index.html file, apache served that fine so it wasn't a permissions issue.
如果我创建了一个公共/索引。html文件,apache服务的很好,所以它不是权限问题。
I also saw this, which meant passenger was starting up ok:
我也看到了,这意味着乘客开始了:
[ 2015-05-11 18:23:53.9594 4964/b7415700 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[2015-05-11 18:23:53 9594 4964/b7415700代理/监督/主要。所有的Phusion乘客代理都开始了!
参见https://www.phusionpassenger.com/documentation/Users%20guide%20Apache%204.0.html _i_get_a_403_forbidden_error
So basically with passenger 5.x (in the release notes it says that rails 2.2 isn't supported, 2.3 is only supported if you create a "config.ru" file in the root of your rails app. It works with old versions of rack like rails 2.3 requires, just remove your newer rack gem and install 1.1.6 or what not, remove vendored rack gems if any. GL!
所以基本上是乘客5。x(rails 2.2的发布说明它说不支持,2.3仅支持如果你创建一个“config.ru”文件在您的rails应用程序的根源。它使用旧版本的架像rails 2.3要求,只是把你的新架的宝石和安装1.1.6或者没有,删除供应商架宝石。GL !
Also as a side note, this message:
另外,这条信息是:
[Mon May 11 18:25:10.235574 2015] [core:alert] [pid 5263:tid 3017780032] [client 127.0.0.1:56737] /home/rdp/dev/prod_flds/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[[endnoteref: 11]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnohtaccess:无效的命令“RewriteEngine”,可能拼写错误,或者由服务器配置中不包含的模块定义。
meant "remove your public/.htaccess file it's not needed typically by passenger"
意思是“删除您的公共/。htaccess文件,通常不需要乘客"
#3
2
I also got an 403 error using passenger for rails in apache on my Mac OS 10.9 (an Unix-like system). Here's some tips:
在我的Mac OS 10.9(一个类unix系统)中,我还在apache中使用了一个403的错误。这里有一些小贴士:
- You can check apache log directory and see the what happened. The directory: /var/log/apache2/error_log.
- 您可以检查apache日志目录并查看发生了什么。目录:/var/log/apache2/error_log.
-
Issue: Permission denied: access to / denied ( filesystem path 'path_apache_access' ) because search permissions are missing on a component of the path.
问题:权限被拒绝:访问/拒绝(文件系统路径'path_apache_access'),因为在路径的一个组件上缺少搜索权限。
Check 'path_apache_access' by CLI: ls -ld 'path_apache_access' and use chmod +x to change the path privilege.
检查“path_apache_access”通过CLI: ls -ld“path_apache_access”并使用chmod +x更改路径特权。
Also, note this: Httpd Wiki - (13) Permission Denied-.
另外,请注意:Httpd Wiki -(13)权限被拒绝。
-
Issue: configuration error: couldn't perform authentication. AuthType not set!.
问题:配置错误:无法执行身份验证。AuthType没有设置!
Issue: client denied by server configuration.
问题:客户端拒绝服务器配置。
Go to /etc/apache2/httpd.conf and take a look on <Directory> tag.
去/etc/apache2/httpd.conf并查看
标记。 Check apache version by CLI: apachectl -v, if Apache < 2.4, do NOT uncomment "Require all granted".
通过CLI检查apache版本:apachectl -v,如果apache < 2.4,不要取消注释“要求全部授予”。
<Directory "rails_app_directory/public"> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: # Require all granted Options FollowSymLinks Order allow,deny Allow from all </Directory>
#4
1
Answer was that passenger gave me 403 because i had to set environment variable "RackEnv" on apache configuration to "development" (on my case).
答案是那个乘客给了我403,因为我必须在apache配置上设置环境变量“RackEnv”以“开发”(在我的例子中)。
#1
15
First of all check your error log. By default, it placed at /var/log/apache2/
.
首先检查您的错误日志。默认情况下,它位于/var/log/apache2/。
If you have client denied by server configuration
issue, check your site conf file at /etc/apache2/sites-available/your-site.conf
. It must be in compliance with Phusion Passenger User Guide. Take a look on Require all granted
.
如果您的客户端被服务器配置问题拒绝,请在/etc/apache2/site .conf中检查您的站点conf文件。它必须符合Phusion乘客用户指南。看一看要求都是理所当然的。
<Directory "/home/user/folder">
Require all granted
Options FollowSymLinks
# This relaxes Apache security settings.
AllowOverride None
# MultiViews must be turned off.
Order allow,deny
Allow from all
</Directory>
#2
4
OK for me this meant I was running rails 2.3 and using Phusion Passenger 5.x
对我来说,这意味着我在运行rails 2.3和使用Phusion乘客5。x。
Apparently 5.x doesn't work with 2.2 at all, and requires 2.3 for you to copy in a config.ru file so that it uses rack for the backend.
显然是5。x与2.2根本不兼容,并且需要2.3让您在config.ru文件中复制,以便后端使用机架。
example config.ru file for 2.3:
示例config.ru文件2.3:
# Rack Dispatcher
# Require your environment file to bootstrap Rails
require File.dirname(__FILE__) + '/config/environment'
# Dispatch the request
run ActionController::Dispatcher.new
I could not figure out why no incantations seemed to work, it was like Passenger was ignoring my rails app.
我搞不懂为什么没有咒语管用,就像乘客无视我的rails应用。
In my /var/log/apache2/error.log file, I had this:
在我/var/log/apache2/error.日志文件,我有这个:
[Mon May 11 15:47:00.397891 2015] [autoindex:error] [pid 17490:tid 3058694976] [client 216.49.181.251:49248] AH01276: Cannot serve directory /home/x/y/railsapp/public/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive, referer: https://www.google.com/
[[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 3]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref
Which confused the heck out of me an apparently meant "passenger isn't running on that virtual host".
让我感到困惑的是,显然这意味着“乘客并没有在虚拟主机上运行”。
If I created a public/index.html file, apache served that fine so it wasn't a permissions issue.
如果我创建了一个公共/索引。html文件,apache服务的很好,所以它不是权限问题。
I also saw this, which meant passenger was starting up ok:
我也看到了,这意味着乘客开始了:
[ 2015-05-11 18:23:53.9594 4964/b7415700 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
[2015-05-11 18:23:53 9594 4964/b7415700代理/监督/主要。所有的Phusion乘客代理都开始了!
参见https://www.phusionpassenger.com/documentation/Users%20guide%20Apache%204.0.html _i_get_a_403_forbidden_error
So basically with passenger 5.x (in the release notes it says that rails 2.2 isn't supported, 2.3 is only supported if you create a "config.ru" file in the root of your rails app. It works with old versions of rack like rails 2.3 requires, just remove your newer rack gem and install 1.1.6 or what not, remove vendored rack gems if any. GL!
所以基本上是乘客5。x(rails 2.2的发布说明它说不支持,2.3仅支持如果你创建一个“config.ru”文件在您的rails应用程序的根源。它使用旧版本的架像rails 2.3要求,只是把你的新架的宝石和安装1.1.6或者没有,删除供应商架宝石。GL !
Also as a side note, this message:
另外,这条信息是:
[Mon May 11 18:25:10.235574 2015] [core:alert] [pid 5263:tid 3017780032] [client 127.0.0.1:56737] /home/rdp/dev/prod_flds/public/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
[[endnoteref: 11]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref: 11]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnoteref:10]] [[endnohtaccess:无效的命令“RewriteEngine”,可能拼写错误,或者由服务器配置中不包含的模块定义。
meant "remove your public/.htaccess file it's not needed typically by passenger"
意思是“删除您的公共/。htaccess文件,通常不需要乘客"
#3
2
I also got an 403 error using passenger for rails in apache on my Mac OS 10.9 (an Unix-like system). Here's some tips:
在我的Mac OS 10.9(一个类unix系统)中,我还在apache中使用了一个403的错误。这里有一些小贴士:
- You can check apache log directory and see the what happened. The directory: /var/log/apache2/error_log.
- 您可以检查apache日志目录并查看发生了什么。目录:/var/log/apache2/error_log.
-
Issue: Permission denied: access to / denied ( filesystem path 'path_apache_access' ) because search permissions are missing on a component of the path.
问题:权限被拒绝:访问/拒绝(文件系统路径'path_apache_access'),因为在路径的一个组件上缺少搜索权限。
Check 'path_apache_access' by CLI: ls -ld 'path_apache_access' and use chmod +x to change the path privilege.
检查“path_apache_access”通过CLI: ls -ld“path_apache_access”并使用chmod +x更改路径特权。
Also, note this: Httpd Wiki - (13) Permission Denied-.
另外,请注意:Httpd Wiki -(13)权限被拒绝。
-
Issue: configuration error: couldn't perform authentication. AuthType not set!.
问题:配置错误:无法执行身份验证。AuthType没有设置!
Issue: client denied by server configuration.
问题:客户端拒绝服务器配置。
Go to /etc/apache2/httpd.conf and take a look on <Directory> tag.
去/etc/apache2/httpd.conf并查看
标记。 Check apache version by CLI: apachectl -v, if Apache < 2.4, do NOT uncomment "Require all granted".
通过CLI检查apache版本:apachectl -v,如果apache < 2.4,不要取消注释“要求全部授予”。
<Directory "rails_app_directory/public"> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: # Require all granted Options FollowSymLinks Order allow,deny Allow from all </Directory>
#4
1
Answer was that passenger gave me 403 because i had to set environment variable "RackEnv" on apache configuration to "development" (on my case).
答案是那个乘客给了我403,因为我必须在apache配置上设置环境变量“RackEnv”以“开发”(在我的例子中)。