Install NGINX on Raspberry PI
This guide is fairly barebones as NGINX installation is a well covered topic. You can think of this article as a cheatcheat for managinging the NGINX server process, as well as where to find config files.
sudo apt install nginx
NGINX should now be running on port 80. Check this by navigating to port 80 of your Pi,
http://pi1.local/. You should see a “Welcome to NGINX” screen. Make sure to replace
pi1.local with the IP address of your Raspberry Pi.
Starting, stopping and restarting NGINX
The following commands show how to manage the NGINX server itself.
sudo systemctl start nginx
sudo systemctl stop nginx
If you change configurations you may need to restart NGINX in order for the changes to take effect.
sudo systemctl restart nginx
Start NGINX at boot
Run the following command to tell
systemd to automatically start NGINX at boot
sudo systemctl enable nginx
If you’d like to disable NGINX running at boot, try the following command
sudo systemctl disable nginx
NGINX config files locations
- General config:
- Virtual host config:
Lastly, to make development easier, give the unix group
pi read, write and execute permissions to the NGINX root sites folder:
sudo chown -R www-data:pi /var/www/html/ sudo chmod -R 770 /var/www/html/