1. What is Nginx?
Nginx is a web server that can serve static HTML, CSS, JavaScript and image files. It can also act as a reverse proxy. In this project, Nginx serves the website from /var/www/html.
2. Check the service
sudo systemctl status nginx --no-pager sudo systemctl is-active nginx
The service should report active when running. Use q to exit a status view if needed.
3. Understand the website directory
ls -lah /var/www/html
Files in this directory may be served by the default Nginx site. Check your active Nginx configuration before changing document roots.
4. Validate and reload Nginx
sudo nginx -t sudo systemctl reload nginx
Run the configuration test before reloading. A reload applies configuration changes without intentionally stopping the service. For HTML-only changes, a reload is normally unnecessary.
5. Verify the website
curl -I http://localhost/ curl -s http://localhost/ | head
Open the server's public IP address in a browser to check the site. If it does not load, check the cloud firewall rules and confirm that HTTP port 80 is allowed only as intended.
6. Deployment checklist
- HTML files are saved in the correct document root.
- Image paths and links point to existing files.
- File permissions allow Nginx to read website files.
sudo nginx -tsucceeds after configuration changes.- Cloud firewall rules and billing are reviewed.
Do not expose SSH (port 22) to everyone unless required. Restrict administrative access to trusted IP addresses when possible.
Revision Questions
- What is Nginx used for?
- Where are the current website files stored?
- Why run
nginx -tbefore a reload? - What should you check if the public website is unreachable?