View on GitHub

RPi NGINX Webserver

Using the NGINX to serve static pages

Home

Description

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:

Overview

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

Procedures

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 http://192.168.84.1
    • 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 https://github.com/gary-dalton/RaspberryPi-projects.git rpi
  • Download other resources
    • mkdir resources
    • cd resources
    • sudo links https://www.ualberta.ca/~enoch/Readings/The_Art_Of_War.pdf
    • sudo wget "http://www.hackerhighschool.org/lessons/HHS_en1_Being_a_Hacker.v2.pdf"

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.