Configure NginX Server as a Proxy on a Windows OS

Last modified by Eleni Cojocariu-testing account on 2026/08/21 17:10

Tutorial

NginX forwards requests to the XWiki Servlet Container on a Windows system, using the directives XWiki needs. Windows has no NginX package and no sites-available directory, so the server is unpacked from an archive and everything is configured in the single conf\nginx.conf file.

  1. Make sure your wiki is running and reachable locally, for example at http://localhost:8080/xwiki.
  2. Download the Windows build of NginX.
  3. Extract the archive to C:\nginx.
  4. Replace the server block that C:\nginx\conf\nginx.conf already holds with the following content, inside the http section of that file:
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ""      "";
    }
    
    server {
        listen 80;
        server_name localhost;
    
        access_log logs/xwiki-access.log;
        error_log logs/xwiki-error.log;
    
        client_max_body_size 0;
    
        location = / {
            return 301 /xwiki/;
        }
    
        location /xwiki {
            proxy_pass http://localhost:8080;
    
            proxy_set_header Host $http_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 $scheme;
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_set_header Forwarded "";
    
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
    
            proxy_redirect off;
        }
    }
  5. Open a Command Prompt, go to the installation directory with cd C:\nginx, and check the configuration: nginx -t.
  6. Start NginX: start nginx. After any later change to nginx.conf, use nginx -s reload instead.
  7. Open http://localhost in a browser. NginX redirects to http://localhost/xwiki/ and the wiki loads through port 80, with no port number in the address.

FAQ

Why does the NginX welcome page answer instead of the wiki?

The server block the archive ships is still in nginx.conf. Two blocks listening on port 80 for the same server_name only produce a warning, and NginX answers with the first of them.

Can NginX run as a Windows service?

No. NginX on Windows runs as a console application, with no equivalent of the Apache httpd.exe -k install command, and it is stopped with nginx -s quit. Running it unattended needs a third-party service wrapper.

Is NginX on Windows suitable for a production wiki?

Its own documentation calls it a beta version: only one worker process does any work, and only the select() and poll() connection methods are available. Serve a production wiki from a Linux host, or with Apache HTTP Server on Windows.

Related

Get Connected