Files
portal-webapp/docs/src/appendix/NginxAppendex.tex
T

25 lines
1.0 KiB
TeX

\chapter{NGINX Configuration}
\label{sample-nginx.conf}
Place the map in the \command{http} context and the location in your site's HTTPS server block. Configure your hostname, TLS certificates, and HTTP-to-HTTPS redirect in the surrounding site configuration. This forwards the application context and supports WebSocket upgrades.
\begin{lstlisting}[caption={NGINX forwarding directives}]
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# Inside the HTTPS server block:
location /portal/ {
client_max_body_size 10m;
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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 600s;
}
\end{lstlisting}
See \url{https://nginx.org/en/docs/http/websocket.html} for WebSocket forwarding details.