[英]403 forbidden error in Passenger+Nginx+rails configuration
I have installed nginx+passenger in amazon-linux. 我在amazon-linux中安装了nginx + passenger。 By
rvmsudo passenger-install-nginx-module
通过
rvmsudo passenger-install-nginx-module
After I edited /var/opt/nginx/nginx.conf
as below: 我编辑
/var/opt/nginx/nginx.conf
后如下:
root /home/ec2-user/current/public/index;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/ec2-user/current/public/index;
index index.html index.htm;
}
I had thrown with 403 forbidden error and so, I checked my path, it was correct. 我已经抛出403禁止错误,因此,我检查了我的路径,这是正确的。
Thanks in advance 提前致谢
Your permissions are too strict and don't allow Nginx to access your root directory. 您的权限过于严格,不允许Nginx访问您的根目录。 Relax permissions like this:
像这样放松权限:
chmod o+x /home/ec2-user/current
chmod o+x /home/ec2-user
I think you want your nginx config to point the root just to the public
folder: 我想你希望你的nginx配置将root指向
public
文件夹:
root /home/ec2-user/current/public;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/ec2-user/current/public;
index index.html index.htm;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.