403 Passenger + Nginx + rails配置中的禁止错误

时间:2013-11-08 13:39:24

标签: nginx amazon-ec2 passenger

我在amazon-linux中安装了nginx + passenger。截至rvmsudo passenger-install-nginx-module

我编辑/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;
    }

我已经抛出403禁止错误,因此,我检查了我的路径,这是正确的。

enter image description here

提前致谢

2 个答案:

答案 0 :(得分:2)

您的权限过于严格,不允许Nginx访问您的根目录。放宽这样的权限:

chmod o+x /home/ec2-user/current
chmod o+x /home/ec2-user

答案 1 :(得分:1)

我认为你希望你的nginx配置只将根指向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;
    }