【发布时间】:2016-10-21 07:26:32
【问题描述】:
这是我的 nginx 的内容。
我当前的访问网址是http://localhost/lampi/,我收到了回复403 forbidden。
我的服务器的文档根目录是 /Library/WebServer/Documents/。
当我访问http://localhost/ 时,它显示正常。我还可以看到 index.html 页面的内容。
我不知道这是怎么回事。我检查了 stackoverflow 中的前 10 个页面。
server {
server_name localhost;
access_log /var/log/nginx/nginx.host.access.log main;
root /Library/WebServer/Documents/;
location / {
#root html;
index index.html index.htm index.php;
}
location /lampi {
#autoindex on;
if (!-e $request_filename){
rewrite ^/lampi/(.*)$ /lampi/index.php?s=$1 last;
}
}
location ~ \.php$ {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /Library/WebServer/Documents/lampi/$fastcgi_script_name;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_param HTTP_PROXY "";
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
#location /images/ {
# root /usr/local/var/www;
#}
}
【问题讨论】: