nginx.ccWeb server troubleshooting desk

Halo nginx rewrite rules

nginx rewrite rules for Halo, generated for your domain, root, PHP-FPM and HTTPS as a full server block or snippet and Caddy versions and cited sources.

Checked against official docs Source: docs.halo.run · FAQ (413 / reverse proxy) · halo.run · fixing 413

Nginx · Halo

Save as /etc/nginx/conf.d/example.com.conf · Apply: nginx -t && systemctl reload nginx
server {
    listen 80;
    listen [::]:80;
    server_name example.com;

    location ^~ /.well-known/acme-challenge/ {
        root /var/www/_letsencrypt;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    # Mozilla Intermediate (Mozilla Server Side TLS 6.0)
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
    ssl_prefer_server_ciphers off;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:10m;
    ssl_session_tickets off;
    # No OCSP stapling: Let's Encrypt shut down its OCSP service in 2025.

    server_tokens off;
    client_max_body_size 1024m;

    # Security headers (server level only; a location with its own add_header must repeat the whole set)
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "SAMEORIGIN" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;
    add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
    # CSP must be tailored per site; enable it once you are sure it does not block your own scripts:
    # add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'self'" always;
    add_header Strict-Transport-Security "max-age=63072000" always;

    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_min_length 256;
    gzip_types text/plain text/css text/xml application/json application/javascript application/xml application/rss+xml application/atom+xml image/svg+xml;

    location / {
        proxy_pass http://127.0.0.1:8090;
        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;
    }

    # Hidden files (.git, .env, …)
    location ~ /\.(?!well-known) {
        deny all;
    }
}

Notes

  • Halo is a Java app: no rewrites, just a reverse proxy. Its external URL must match the real domain (incl. https), or assets break.
  • client_max_body_size 1024m follows Halo's FAQ to avoid 413 on uploads.

Apache .htaccess

No standard .htaccess for this app.

Caddy equivalent

example.com {
    encode zstd gzip
    reverse_proxy 127.0.0.1:8090
}

Every generated config passes the Linter; still run nginx -t on the server. Inner pages 404? See 404 & try_files.

FAQ

Does Halo need rewrite rules?

No. Halo does its own routing; nginx only reverse-proxies to 127.0.0.1:8090 and passes Host, X-Forwarded-Proto and friends.

Anything else to watch for with Halo?

Halo is a Java app: no rewrites, just a reverse proxy. Its external URL must match the real domain (incl. https), or assets break.

Sponsored slot (empty)
VPS / CDN recommendations may appear here later, labelled as affiliate links. There are no referral links today.