Wiki source code of NginX Server Key Configurations
Last modified by Eleni Cojocariu on 2026/05/20 16:51
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{warning}} | ||
| 2 | WIP | ||
| 3 | {{/warning}} | ||
| 4 | |||
| 5 | NginX is a widely used open-source web server, often utilized as a reverse proxy to forward client requests to backend applications like XWiki. The following configuration keys ensure proper communication between NginX and XWiki: | ||
| 6 | |||
| 7 | |=Configuration line|=Description / Official Nginx documentation meaning | ||
| 8 | |##listen 80##|Specifies the port Nginx listens on. Port 80 is the default for HTTP traffic. | ||
| 9 | |##server_name localhost##|Defines the domain name(s) this server block responds to (e.g., localhost or example.com). | ||
| 10 | |##client_max_body_size 0##|Defines the maximum allowed size of the client request body. A value of 0 disables the size limit, allowing unlimited upload size. | ||
| 11 | |##access_log /var/log/nginx/xwiki-access.log##|Path to the file where all successful client requests are logged. | ||
| 12 | |##error_log /var/log/nginx/xwiki-error.log##|Path to the file where Nginx logs errors (configuration issues, backend failures). | ||
| 13 | |##location /xwiki { ... }##|Matches requests with URI starting with /xwiki and applies the enclosed configuration. | ||
| 14 | |##proxy_pass http://localhost:8080/xwiki/####|Forwards incoming requests to a backend server (reverse proxy). Here, to XWiki running on port 8080. | ||
| 15 | |##proxy_set_header Host $host##|Passes the original Host header from the client request to the backend server. | ||
| 16 | |##proxy_set_header X-Real-IP $remote_addr##|Sends the real client IP address to the backend. | ||
| 17 | |##proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for##|Adds the client IP to the X-Forwarded-For chain (used when multiple proxies exist). | ||
| 18 | |##proxy_set_header X-Forwarded-Proto http##|Indicates whether the original request was HTTP or HTTPS. | ||
| 19 | |##proxy_http_version 1.1##|Forces HTTP/1.1, required for WebSocket connections. | ||
| 20 | |##proxy_set_header Upgrade $http_upgrade##|Allows protocol upgrade (needed for WebSockets). | ||
| 21 | |##proxy_set_header Connection "upgrade"##|Ensures connection header allows upgrade to WebSocket. | ||
| 22 | |##proxy_redirect off##|Disables automatic rewriting of redirect URLs from the backend. | ||
| 23 | |##location = / { return 301 /xwiki; }##|Exact match for root URL ("/"), redirects permanently to /xwiki. |