Nginx - allow access to directory

22,181

O.k first I had to find the configuration file. I found it in the /etc/nginx/conf.d directory.

Than I cane across this tutorial: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html

I added this block inside the server block:

location /srita/ {
index index.html;
autoindex on;
}
Share:
22,181

Related videos on Youtube

DavSev
Author by

DavSev

Updated on September 18, 2022

Comments

  • DavSev
    DavSev over 1 year

    I have a WordPress site on a LAMP server (CentOS 7). In the WordPress root folder I added a folder called minisite.

    www.example.com/minisite/file.html
    

    While trying to access the minisite directory from the browser I get a 403 error.

    How can I allow the access to the minisite directory?

    I read the following question but the answer wasn't very clear to me. Also, I couldn't figure out in what file the changes are made. Nginx - Allow access to folder directory only by referring URL

    • MrWhite
      MrWhite almost 7 years
      Are you literally trying to access the bare directory, eg. /minisite/ (as stated), or a file in that directory, eg. /minisite/file.html, as in your example URL?
    • DavSev
      DavSev almost 7 years
      O.K, I found the configuration file at the /etc/nginx/conf.ddirectory. I added this block to the file : location /minisite/ { autoindex on; } now I can access the directory but I see a list of files in it. how can I auto load the index.html file that is in the minisite directory