我已经尝试了很多配置的变种,但我仍然无法让它按预期工作.有什么建议?
原文链接:https://www.f2er.com/php/139253.htmllocation ~ /views/(.+)\.PHP${ deny all; }
配置:
server { listen 80; server_name ...; #charset koi8-r; #access_log logs/host.access.log main; location / { root /srv/www; index index.PHP index.html index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/Nginx/html; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/Nginx/html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.PHP${ # root html; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.PHP; fastcgi_param SCRIPT_FILENAME /srv/www$fastcgi_script_name; } if (!-e $request_filename){ rewrite ^/([0-9]+)$/get.PHP?get=$1 last; rewrite ^/add$/add.PHP; rewrite ^/RSS$/RSS.PHP; } location ~ /views/(.+)\.PHP${ deny all; } }