Set up NginX Proxy Server
Last modified by Eleni Cojocariu on 2026/05/20 16:51
Tutorial
To set up NginX proxy server:
- Make sure your wiki is running and accessible locally, (e.g., at
http://localhost:8080/. - Install Nginx.
- Start the NginX service. For example in a Linux OS,
sudo systemctl start nginx, or in Windowsstart nginx.- You can test if it's running:
curl http://localhost. You should see the default NginX page.
- You can test if it's running:
- Create or edit the Nginx configuration file:
- Open (e.g., in Linux OS
sudo nano /etc/nginx/sites-available/xwiki, or in WindowsC:\nginx\conf\nginx.confand replace or adapt with a clean version:# Server server{ listen 80; server_name localhost; # Logs access_log /var/log/nginx/xwiki-access.log; error_log /var/log/nginx/xwiki-error.log; client_max_body_size 0; # Reverse proxy to XWiki location /xwiki { proxy_pass http://localhost:8080/xwiki/; # Headers 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 http; # WebSocket proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; } # Redirect root -> xwiki location = / { return 301 /xwiki; } }
- Open (e.g., in Linux OS
- Enable the site. For example in a Linux OS,
sudo ln -s /etc/nginx/sites-available/xwiki /etc/nginx/sites-enabled/, or in Windows add the server block directly inside nginx.conf, inside thehttp{}section. - Test config. For example in a Linux OS,
sudo nginx -t, or in Windowsnginx -t. - Restart Nginx, if the step above was successful. For example in a Linux OS,
sudo systemctl restart nginx, or in Windowsnginx -s reload. - Test in browser:
- Go to:
http://yourdomain.com, or locally:http://localhost
- Go to:
- Test proxy behavior:
- Check headers:
curl -I http://localhost. - Check logs. For example in a Linux OS,
tail -f /var/log/nginx/access.log, or in WindowsC:\nginx\logs\access.log
- Check headers:
FAQ
Why do I need to enable the configuration?
NginX doesn't automatically use every configuration file you create. The real configuration file is located in /etc/nginx/sites-available/xwiki, but NginX loads configuration from the /etc/nginx/sites-enabled/ directory.
How can I configure the proxy server if I have a custom domain?
Replace the ServerName localhost with your custom domain, for example ServerName wiki.example.com. If needed (e.g., when using custom local domain, which are not real public domains), you must configure DNS resolution so that your system knows where to route the request. To do so, edit the hosts file to add for example 127.0.0.1 wiki.example.local.
More
To find more about the current topic, you can search or use the table below and filter the columns to narrow your choices.