Proxy settings

The second section in the nginx configuration settings that is important is the reverse proxy settings.

We include the proxy_pass directive inside the location block with the value of the address and port of the web server. This specifies that all requests should be sent to the specified proxy server (igweb) located at http://192.168.1.207:8080.

Remember to replace the IP address 192.168.1.207 shown in this example with the IP address of the machine that is running your igweb instance.

The reverse proxy will fetch the response from the igweb server instance and send it back to the web client.

The proxy_set_header directive allows us to redefine (or append) fields to the request header that are passed on to the proxy server. We have included the X-Forwaded-For header so that the proxy server can identify the originating IP address of the web client that initiated the request.

To support the proper functioning of websockets (which the live chat feature depends on), we include the following proxy settings. First, we specify using the proxy_http_version directive that the server will be using HTTP version 1.1. The "Upgrade" and "Connection" headers are not passed to a proxied server by default. Due to this, we must send these headers to the proxy server using the proxy_set_header directive.

We can install nginx by issuing the following command:

$ sudo apt-get install nginx

Upon installing nginx, the web server usually starts up by default. However if it doesn't, we can start up nginx by issuing the following command:

$ sudo systemctl start nginx

The nginx.conf file found in the $IGWEB_APP_ROOT/deployments-config/standalone-setup folder can be placed in the production server's /etc/nginx folder.

Figure 11.3 depicts the 502 Bad Gateway error encountered when we attempt to access the igweb.kamesh.com URL:

Figure 11.3: The 502 Bad Gateway Error

We get this server error because we haven't started igweb yet. To get igweb up and running, we first need to set up a place on the server where the igweb binary executable and the static assets will reside.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.239.44