Configuring Nginx

This section is to configure Nginx as a reverse proxy server in a Windows machine.

Step 1: Go to the ..\nginx-1.19.10\conf folder and open the nginx.conf file in a text editor.

Step 2: Locate the "server" block and add another "server" block as shown below.

This is to configure Nginx as a reverse proxy server which will redirect requests made to the URL: https://172.16.100.39:8080/ to the PowerServer Web APIs running on Kestrel at https://172.16.100.35:6000/.

    server {
        listen  8080;
        location / {
           proxy_set_header Host $http_host;
           proxy_pass  https://172.16.100.35:6000;
        }
    }


Tip: In Windows, you can execute the command "netstat -ano | findstr 8080" to check if the port number is occupied by any other program. For details, refer to Choosing an appropriate port number.

Step 3: Check if any syntax errors in the Nginx configuration file, and then restart Nginx for the changes to take effect.

nginx -t
nginx -s reload

Step 4: Verify that the Nginx processes are running.

tasklist /fi "imagename eq nginx.exe"

Step 5: If you have set up a firewall on the server, configure the firewall to allow port 8080 (by following the instructions in "Configuring Windows Defender Firewall").

Note

If the firewall blocks the port number, you will have the following error when running the application.