nginx 服务器目录禁止索引

2017-08-08 10:18:52 +08:00
 codesuper
我是在 window 下用的 laragon 集成环境用来学习开发 laravel。启动 nginx 服务器可以打开 localhost:8080,但是打不开 WWW 目录下面的网站,也就是 XXX.dev ,会提示服务器拒绝连接请求。切换成 apache 服务器不存在该问题
错误日志提示:

2017/08/08 09:40:24 [error] 9928#9048: *4 directory index of "D:/laragon/www/poi/" is forbidden, client: 127.0.0.1, server: localhost, request: "GET /poi/ HTTP/1.1", host: "localhost:8080"


nginx.conf 的配置:

#user nobody;
worker_processes 1;

#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 application/octet-stream;

#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;

include "D:/laragon/etc/nginx/php_upstream.conf";
include "D:/laragon/etc/nginx/sites-enabled/*.conf";
client_max_body_size 2000M;
}
2370 次点击
所在节点    PHP
2 条回复
voocel
2017-08-08 12:39:54 +08:00
关键部分没贴出来
lamCJ
2017-08-08 18:36:36 +08:00
server ?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/381253

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX