ngnix journey
Step 3: Configure Nginx Server Block
Create a directory for the web page (replace with your desired path if needed):
Assign ownership to the current user (replace with your user):
Create a simple index.html file for testing:
Create a new server block configuration file:
Add the following configuration to the file:
Enable the site by creating a symbolic link to
sites-enabled
:Test the Nginx configuration for syntax errors:
Reload Nginx to apply the changes:
To add SSL it was quite painless
sudo apt update
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
this already made changes to sudo nano reverse-proxy
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
this already made changes to sudo nano reverse-proxy
sudo certbot renew --dry-run
Note if you have this subdomaining going on
sudo certbot --nginx -d subdomain.domain.com -d domain.com
Is probably necessary as it will (E)xpand the cert to cover both.
CGPT recommends viewing:
Note if you have this subdomaining going on
sudo certbot --nginx -d subdomain.domain.com -d domain.com
Is probably necessary as it will (E)xpand the cert to cover both.
CGPT recommends viewing:
Step 6: Monitor and Maintain
Log Monitoring: Check the Nginx logs for any issues:
- Access logs:
/var/log/nginx/access.log
- Error logs:
/var/log/nginx/error.log
- Access logs:
Certificate Expiration: Keep an eye on your certificate expiration dates (although Certbot handles renewals automatically).
Comments
Post a Comment