- Open up a terminal and ssh into your server. Once in, run
sudo nano /etc/nginx/apps/external.conf
and paste the contents in the codeblock below:
# This config serves an unprotected index of files stored at /srv/external (from the softlinked path)
location /external {
include /etc/nginx/snippets/fancyindex.conf;
}
- Now, we’re going to softlink the folder we want to share to /srv/external. This allows for you to share a folder from your user folder, or anywhere else on the machine to the public.
sudo ln -s /path/to/shared/directory /srv/external
- Test the config:
sudo nginx -t
- If return is OK, you can reload the nginx service with
sudo service nginx reload
.
Note: If you don’t get an OK, go over your nginx configuration, make sure there aren’t multiple files for each app and that no two things are being served at the same location. Do a configtest again until you find your issue, then reload the nginx service.