Set up NginX Proxy Server

Last modified by Eleni Cojocariu on 2026/05/20 16:51

Tutorial

Warning

WIP: create a separate tutorial for Windows OS.

To set up NginX proxy server:

  1. Make sure your wiki is running and accessible locally, (e.g., at http://localhost:8080/.
  2. Install Nginx.
  3. Start the NginX service. For example in a Linux OS, sudo systemctl start nginx, or in Windows start nginx.
    • You can test if it's running: curl http://localhost. You should see the default NginX page.
  4. Create or edit the Nginx configuration file:
    • Open (e.g., in Linux OS sudo nano /etc/nginx/sites-available/xwiki, or in Windows C:\nginx\conf\nginx.conf and 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;
              }
      }
  5. 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 the http{} section. 
  6. Test config. For example in a Linux OS, sudo nginx -t, or in Windows nginx -t.
  7. Restart Nginx, if the step above was successful. For example in a Linux OS,sudo systemctl restart nginx, or in Windows nginx -s reload.
  8. Test in browser:
    • Go to: http://yourdomain.com, or locally: http://localhost
  9. 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 Windows C:\nginx\logs\access.log

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.

Related

Get Connected