zigford.org

About | Links | Scripts
Sharing linux/windows scripts and tips

Nginx as a file server

April 21, 2019 — Jesse Harris

FTP, SMB, SSH, HTTP... The list goes on.

There are many ways to serve files. Here is a quick note of how I edited the default raspbian nginx conf files to enable a simple directory with browsing to be served from a raspberry pi


  1. Install nginx-light

    sudo apt-get install nginx-light -y
    
  2. Make sure group other has x permissions all the way up the tree to where content will be served from. Security warning I recommend only doing this on an internally facing pi.

    sudo chmod o+x /media /media/JesseHD /media/JesseHD/Movies
    
  3. Edit `/etc/nginx/sites-available/default, uncomment the last server section

    server {
            listen 80;
            listen [::]:80;
    
            server_name 192.168.178.88;
    
            root /media/JesseHD/Movies;
            autoindex on;
    
    }
    
  4. Restart nginx

    sudo systemctl restart nginx
    

Tags: raspberry-pi, nginx