Directory listing: 403 Forbidden nginx [closed]

1

I need help, I started using Nginx now, I was researching on it, I tried it, and I do not know how to configure it properly, but I wanted to enable directory search. In its documentation it is ( AutoIndex: on ) but I use this, it does not appear, of error 403. Nginx is in C:/ , but I configured it to be directed to my C:/projetos folder. If anyone knows how I'll handle it.

Code to configure it:

worker_processes  1;

    events {
        worker_connections  1024;
    }

    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;


        server {
            listen 80;
            server_name localhost;

            root C:\Project ;
            index index.html index.htm index.php;

            location / {
                autoindex on;
            }
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    }
    
asked by anonymous 22.06.2015 / 19:54

1 answer

0

Instead of root C:\Project ; use root C:/Project; , I recommend using within location / { (just as it is in the default configuration). It seems that you are trying to configure it with PHP, note that we usually use fastcgi, an example (read the comments followed by # if you have any doubts regarding the use):

worker_processes  1;

# Gera logs de erro
error_log  logs/error.log;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   C:/Project;
            index  index.html index.htm;
            autoindex on;
        }

        error_page  404              /404.html;

        # redireciona páginas de erro para páginas estaticas /50x.html (no root)
        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
            root   html;
        }

        # Configura o php
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;

            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $request_filename;
            include        fastcgi_params;
        }
    }
}
    
22.06.2015 / 20:07