View on GitHub

RPi NGINX Webserver

Using the NGINX to serve static pages



NGINX is an open source web server and reverse proxy that excels at large-scale web integration, application security, and web acceleration.

Next up?

After reading this guide, you may be interested in reading:


  1. Install NGINX
  2. Serve static content
  3. Conclusion.


Install NGINX

  • sudo apt-get install nginx
  • Is it running? sudo service nginx status
  • Check if it is available,
    • locally, links http://localhost/
    • other device, browse to
    • should see the Welcome to nginx page

Serve static content

Your pi is all set to serve static content. The location of the files is /var/www/html.

  • sudo nano /etc/nginx/sites-available/default
    • Just after root /var/www/html; add the line
      • autoindex on;
  • Add these Raspberry Pi guides
    • cd /var/www/html
    • sudo git clone --branch gh-pages rpi
  • Download other resources
    • mkdir resources
    • cd resources
    • sudo links
    • sudo wget ""

Save the image to a file

Now that you have spent all this time getting your Raspberry Pi set up just so, save it to an image for easy reuse. You will still have to change things like usernames, passwords, and hostnames.

Instead of writing a file image to the MicroSD, use the same software to read the MicroSD to a file image. Then when you are ready to spin up your next pi, it will be as easy as, well, pie.