Problem
A server with NGINX has a directory with files it needs to serve over HTTP.
The directory is located at (example): /media/user/data
Question
What configuration is required in NGINX to serve that directory (and all its files and sub-folders) over HTTP?
The served directory over HTTP must be fully accessible and any users should be able to browse through all of the directory's contents.
All steps for configuration required.
Research
Research on the topic found changes will be required in the default file within the sites-available
directory inside the /etc/nginx
folder as such:
location /data {
root /media/user/;
autoindex on;
}
}
Other
From recent comments to proposed answers:
The default file in sites-available was edited to include the directory, then the server was restarted and verified to be capable of serving by visiting 127.0.0.1 which displayed the standard nginx congratulations page. Then when attempting to access http://127.0.0.1/data the server produced a 403 Forbidden error. – Frugal Rasin