Jump to content

Troubleshooting:Nginx Troubleshooting: Difference between revisions

From jb-vpn.uk Wiki
Major update - troubleshooting guide: Nginx Troubleshooting (23 sections) (troubleshooting)
Updated documentation from markdown files
 
Line 1: Line 1:
This guide covers troubleshooting for Nginx configuration and service issues.
'''Note:''' Public HTTPS on this VPS is handled by '''Caddy''' (<code>/etc/caddy/Caddyfile</code>). Use [[System:Service Management]] and <code>journalctl -u caddy</code> for edge proxy issues.
 
This guide covers '''legacy host Nginx''' site files and the '''WebApp stack's internal Nginx''' container. Host Nginx is not the active edge proxy for <code>*.jb-vpn.uk</code> services.


== Configuration Errors ==
== Configuration Errors ==

Latest revision as of 14:04, 16 May 2026

Note: Public HTTPS on this VPS is handled by Caddy (/etc/caddy/Caddyfile). Use System:Service Management and journalctl -u caddy for edge proxy issues.

This guide covers legacy host Nginx site files and the WebApp stack's internal Nginx container. Host Nginx is not the active edge proxy for *.jb-vpn.uk services.

Configuration Errors

[edit]

Syntax Errors

[edit]

Symptoms: nginx -t fails with syntax errors

Solutions:

  • Check for missing semicolons
  • Verify bracket matching
  • Check for typos in directive names

Duplicate Server Names

[edit]

Symptoms: Warning about duplicate server_name

Solutions:

  • Check all configuration files in /etc/nginx/sites-enabled/
  • Remove duplicate server_name entries
  • Ensure only one config per subdomain

Service Issues

[edit]

Nginx Won't Start

[edit]

Check status:

[edit]
   systemctl status nginx

Check logs:

[edit]
   journalctl -u nginx -n 50

Test configuration:

[edit]
   nginx -t

Nginx Reload Fails

[edit]

Test configuration first:

[edit]
   nginx -t

Check for syntax errors in configuration files

[edit]

Verify file permissions:

[edit]
   ls -la /etc/nginx/sites-enabled/

Log Analysis

[edit]

Error Logs

[edit]
==== View recent errors ====
tail -f /var/log/nginx/error.log

== Search for specific errors ==
grep "error" /var/log/nginx/error.log

Access Logs

[edit]
==== View recent access ====
tail -f /var/log/nginx/access.log

== Analyze traffic ==
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn

Common Configuration Issues

[edit]

SSL Certificate Problems

[edit]
  • Verify certificate exists: certbot certificates
  • Check certificate expiration: openssl x509 -in /etc/letsencrypt/live/domain/cert.pem -noout -dates
  • Renew if needed: certbot renew

Proxy Issues

[edit]
  • Check proxy_pass URL is correct
  • Verify target service is accessible
  • Check proxy headers are set correctly
[edit]
  • [Adding Services](index.md) - Service configuration
  • [Service Management](service-management.md) - Service management