从apache迁移到nginx:禁止403目录索引

时间:2017-06-19 19:57:56

标签: php apache amazon-web-services ubuntu nginx

我正在尝试将我的apache服务器迁移到nginx,因此将我的apache vhost转换为nginx。 但是,我遇到了这个'403目录索引''被禁止并且很难找出问题所在。 我想我的nginx conf有些不对劲但不知道是什么:

server {
        listen 8000;

        server_name domain.com www.domain.com;

        root /var/www/html/domain;

        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php7.0-fpm.sock;
            fastcgi_index app.php;
            include fastcgi_params;
        }

        location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            deny all;
        }

        location ~/\.ht {
            deny all;
        }

        index app.php?method=index&lang=;

        location / {
            if (!-e $request_filename){
                rewrite ^/(en|fr|de)$ /app.php?method=index&lang=$1 break;
            }
        }
}

服务器位于AWS EC2实例上的ubuntu下,该应用程序是一个非常轻的php应用程序,它是在没有任何框架或任何框架的情况下构建的。

0 个答案:

没有答案