# /etc/nginx/conf.d/wp.viossa.net.conf # (or /etc/nginx/sites-available/wp.viossa.net + symlink into sites-enabled) # # Host nginx -> 127.0.0.1:18080 (WordPress container). Names are prefixed # "wp_viossa_net" so they can't collide with the other sites on this box. # This file must be included inside http { } (conf.d / sites-enabled both are). upstream wp_viossa_net { server 127.0.0.1:18080; # keep in sync with WP_HOST_PORT in .env keepalive 16; } # Brute-force brake for the login page (10 requests/minute/IP, small burst) limit_req_zone $binary_remote_addr zone=wp_viossa_net_login:10m rate=10r/m; # ---------- HTTP: ACME challenge + redirect ---------- server { listen 80; listen [::]:80; server_name wp.viossa.net; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 301 https://$host$request_uri; } } # ---------- HTTPS ---------- server { listen 443 ssl; listen [::]:443 ssl; http2 on; # nginx >= 1.25.1. On older nginx, delete this line # and use: listen 443 ssl http2; server_name wp.viossa.net; ssl_certificate /etc/letsencrypt/live/wp.viossa.net/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/wp.viossa.net/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_session_cache shared:SSL_wp_viossa_net:10m; ssl_session_timeout 1d; ssl_session_tickets off; access_log /var/log/nginx/wp.viossa.net.access.log; error_log /var/log/nginx/wp.viossa.net.error.log; client_max_body_size 64M; # match php/uploads.ini add_header Strict-Transport-Security "max-age=31536000" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Proxy settings at server level are inherited by every location below # that doesn't define its own proxy_set_header lines. proxy_http_version 1.1; proxy_set_header Connection ""; 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_set_header X-Forwarded-Host $host; proxy_read_timeout 120s; proxy_send_timeout 120s; # Don't expose dotfiles (but allow /.well-known/) location ~ /\.(?!well-known) { deny all; } # XML-RPC is a common brute-force/DDoS target; remove this block # if you need the mobile app or Jetpack. location = /xmlrpc.php { return 403; } location = /wp-login.php { limit_req zone=wp_viossa_net_login burst=5 nodelay; limit_req_status 429; proxy_pass http://wp_viossa_net; } location / { proxy_pass http://wp_viossa_net; } }