ngnix journey

 

Step 3: Configure Nginx Server Block

  1. Create a directory for the web page (replace with your desired path if needed):


    sudo mkdir -p /var/www/caputxeta
  2. Assign ownership to the current user (replace with your user):

    sudo chown -R $USER:$USER /var/www/caputxeta
  3. Create a simple index.html file for testing:

    echo "<h1>Welcome to Caputxeta</h1>" > /var/www/caputxeta/index.html
  4. Create a new server block configuration file:

    sudo nano /etc/nginx/sites-available/caputxeta
  5. Add the following configuration to the file:

    server {
    listen 80; server_name caputxeta.kbytes.net caputxeta.internal.kbytes.net; root /var/www/caputxeta; index index.html; location / { try_files $uri $uri/ =404; } }
  6. Enable the site by creating a symbolic link to sites-enabled:

    sudo ln -s /etc/nginx/sites-available/caputxeta /etc/nginx/sites-enabled/
  7. Test the Nginx configuration for syntax errors:

    sudo nginx -t
  8. Reload Nginx to apply the changes:

    sudo systemctl reload nginx


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 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.

Also see https://bytebastard.blogspot.com/2025/06/certbot.html  which helped when I added a new certificate that everything was going to work.

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
  • Certificate Expiration: Keep an eye on your certificate expiration dates (although Certbot handles renewals automatically).

Comments

Popular posts from this blog

git journey

Django Journey

github start project