openresty nginx 访问目录 403 forbidden?

 
环境:openresty nginx php-fpm
 
访问根目录下的 index.html  正常访问,访问目录就出现 403 forbidden。
 
配置文件内容如下:
 
user  root;
worker_processes 4;

error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type text/html;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;

charset utf-8;

access_log logs/host.access.log main;

location / {
root /root/web_site/;
index index.html;
}

location ~ \.php$ {
root /root/web_site/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /root/web_site/$fastcgi_script_name;
include fastcgi_params;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

}
已邀请:

张三俗

赞同来自:

看你的配置文件没设置索引文件(index),改为:
 
location / {
root /root/web_site/;
index index.html index.php;
}
 
如果上面方法不行的话:就把 web_site 目录权限改为 755。

要回复问题请先登录注册