+
82
-

nginx 怎么配置目录只能访问html文件,不能访问php文件?

有个需求,就是配置nginx目录只能访问html文件,不能访问php文件?

有没有高手配置过?

        location ~ [^/]\.php(/|$) {
            #fastcgi_pass remote_php_ip: 9000;
            fastcgi_pass unix: /dev/shm/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
        }


        location ~* ^/onlyhtml/.*.(php|php5)$ {
            deny all;
        }

我这么配置没有效果啊

网友回复

+
1
-

顺序反了,把

        location ~* ^/onlyhtml/...

点击查看剩余70%

我知道答案,我要回答