====== Nginx ====== ---- ===== Example Server Blocks ===== Note: These are messy and need cleaned up. Don't blindly copy-paste may be errors. * [[.nginx : dokuwiki | Dokuwiki ]] * [[.nginx: laravel | Laravel ]] * [[.nginx: react | React ]] * [[.nginx : rocketchat | Rocket.Chat ]] * [[.nginx: vue | Vue ]] ---- ===== Config ===== ** Caching ** location /_assets { expires 30d; root /web/kalen.pw; } ---- **http2** \\ Only works with TLS and modern browsers (though 95%+ usage) server { listen 443 http2 ssl; ... } ---- **Reverse Proxy** \\ Useful for services that run on abnormal ports, but you want to have clean urls to access them server { server_name example.domain.com; location / { proxy_pass http://127.0.0.1:8000; } } ---- ** Redirect all URLs to root** \\ Used, for example, on kalen.pw so any non-found files are redirected to the homepage (as opposed to serving a 404) location / { if (!-e $request_filename) { rewrite ^ / permanent; } } ----