| File | Purpose |
|---|---|
| /etc/nginx/sites-available/yealinbilling | Billing platform site config |
| /etc/nginx/sites-available/wikijs | Wiki.js site config |
| /etc/nginx/sites-enabled/ | Symlinks to active sites |
| /etc/nginx/nginx.conf | Main Nginx config (rarely edited) |
Location: /etc/nginx/sites-available/yealinbilling
server {
listen 80;
server_name billing.yealin.com.au;
# Certbot adds HTTPS redirect here automatically
client_max_body_size 20M;
root /var/www/yealinbilling/staticfiles/frontend;
index index.html;
# Django admin static files
location /static/admin/ {
alias /var/www/yealinbilling/staticfiles/admin/;
expires 30d;
}
# All other static files
location /static/ {
alias /var/www/yealinbilling/staticfiles/;
expires 30d;
}
# Media files (PDF invoices etc)
location /media/ {
alias /var/www/yealinbilling/media/;
}
# Django API
location /api/ {
proxy_pass http://unix:/var/www/yealinbilling/gunicorn.sock;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300;
}
# Django admin
location /admin/ {
proxy_pass http://unix:/var/www/yealinbilling/gunicorn.sock;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300;
}
# React SPA — all other routes
location / {
try_files $uri $uri/ /index.html;
}
}
CRITICAL: /portal/* is NOT proxied to Django. It's served by the React SPA. Only /api/portal/* goes to Django.
| Domain | Expiry | Auto-renew |
|---|---|---|
| billing.yealin.com.au | 2026-09-05 | ✅ certbot.timer |
| wiki.yealin.com.au | 2026-09-05 | ✅ certbot.timer |
# List all certificates
sudo certbot certificates
# Check expiry
sudo certbot certificates | grep -E "Domains|Expiry"
Certificates auto-renew via a systemd timer. To manually renew:
# Test renewal (dry run — no changes)
sudo certbot renew --dry-run
# Force renewal now
sudo certbot renew --force-renewal
# Renew specific domain
sudo certbot renew --cert-name billing.yealin.com.au
# For a new domain (Nginx must be configured first)
sudo certbot --nginx -d newdomain.yealin.com.au --non-interactive --agree-tos -m co@aus.co
sudo certbot revoke --cert-path /etc/letsencrypt/live/billing.yealin.com.au/fullchain.pem
# Test configuration syntax
sudo nginx -t
# Reload config (no downtime)
sudo systemctl reload nginx
# Restart Nginx (brief downtime)
sudo systemctl restart nginx
# View error log
sudo tail -50 /var/log/nginx/error.log
# View access log
sudo tail -50 /var/log/nginx/access.log
sudo ln -s /etc/nginx/sites-available/newsite /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl reload nginxsudo certbot --nginx -d newsubdomain.yealin.com.au --non-interactive --agree-tos -m co@aus.co