Install and configure nginx
Install nginx from the package manager.
sudo apt update
sudo apt install nginx
By default nginx should be running directly on port 80 right after the installation.
To check nginx running status simply nagivate to localhost
or if search for nginx from px aux
output.
ps aux | grep nginx
Opening port in router
There's two address needed here. The Pi IPv4 address and the router gateway address.
Run command this command below to print out all the address.
ipconfig
Find the gateway IP address for the home router and login to the admin panel. Every router have different interface but should have the same setting, look for port forwarding.
Input the Pi local IPv4 address with protocol TCP on port 80 to forward connection from outside network directly to the Pi.
Another thing to look for inside of the router setting is the firewall, this might be blocking the access, add in the Pi address to allow traffic from external network.
Browsing the web
Using the commandline, get the public IP address of the Pi by sending request to ipify services thru the Pi terminal.
curl "https://api.ipify.org"
Now, try to access the sent http request to the Pi public IP thru browser.
If you see the default nginx page meaning the connection successfully establish and your home server is up and running.