V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
codesuper
V2EX  ›  PHP

nginx 服务器目录禁止索引

  •  
  •   codesuper · 2017-08-08 10:18:52 +08:00 · 2355 次点击
    这是一个创建于 2462 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我是在 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;
    }
    voocel
        1
    voocel  
       2017-08-08 12:39:54 +08:00 via Android
    关键部分没贴出来
    lamCJ
        2
    lamCJ  
       2017-08-08 18:36:36 +08:00 via iPhone
    server ?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   852 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:57 · PVG 02:57 · LAX 11:57 · JFK 14:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.