How To Serve Static File Directory Over HTTP Using NGINX
You can achieve that by editing existing Nginx virtualhost (the default one, that you mentioned). Just make sure that /media/user/data directory and all the content inside that directory are readable by the user under Nginx service is started (most probably "nginx" user).
If you want to host those files under different (sub)domain, you can create new Nginx virtualhost, with content like:
server {
listen *:80;
server_name example.com www.example.com;
root /media/user/data;
autoindex on;
}
Update: from the comments below, it was also necessary to modify directory permissions so that Nginx can serve the content and not to return 403 forbiden
error.
Although the permissions of /media/user/data/
directory were good, /media/
and /media/user/
directories were missing executable permissions. The problem was solved with the following command:
sudo chmod o+x /media/ /media/user/