codesuper
V2EX  ›  PHP

nginx 服务器目录禁止索引

  •  
  •   codesuper · Aug 8, 2017 · 2972 views
    This topic created in 3222 days ago, the information mentioned may be changed or developed.
    我是在 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  
       Aug 8, 2017 via Android
    关键部分没贴出来
    lamCJ
        2
    lamCJ  
       Aug 8, 2017 via iPhone
    server ?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5795 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 01:59 · PVG 09:59 · LAX 18:59 · JFK 21:59
    ♥ Do have faith in what you're doing.