NGINX将某些目录标记为403,但未将其他目录标记为

时间:2019-02-27 13:33:06

标签: php nginx

我有一个PHP应用程序,所有请求都应发送到/dispatch.php。我是第一次尝试NGINX,当我启动我的应用程序时,首页可以正常工作,但是当我走到某些路线时,它可以工作,而另一些则失败。例如,/systems/有效,而/login/无效。

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name localhost;
    root /var/www;
    index dispatch.php;

    location / {
         try_files $uri $uri/ /dispatch.php$is_args$args;
    }

    location ~ \.php$ {
        try_files $uri /dispatch.php =404;
        fastcgi_pass api:9000;
        fastcgi_index dispatch.php;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #fixes timeouts
        fastcgi_read_timeout 600;
        include fastcgi_params;
    }
}

0 个答案:

没有答案