Skip to content
Corridor V1.26.08 is out, see what's new

Technology

Nginx

Ask AI

How to install and configure nginx as a reverse-proxy web server for the Corridor Platform.

Nginx logo
Nginx

This section described how to use nginx (https://nginx.org/en/) as a web server, one of the two reverse-proxy options supported alongside Apache. The Platform’s server components can be made highly performant by using the lightweight Nginx as a reverse-proxy along with a WSGI server. Using nginx enabled the server to scale to a large number of users with ease.

To use Nginx, it needs to be installed in the system the daemon should be running with the appropriate site configurations setup.

The official installation instructions can be found at https://nginx.org/en/docs/install.html

The recommended method of installation is to use the package manager provided by the Operating System (apt-get, yum, etc.).

RedHat:

Terminal window
yum install nginx

Ubuntu:

Terminal window
apt install nginx

Once installed, the nginx configuration needs to be created to proxy the web server components as described in https://nginx.org/en/docs/beginners_guide.html#proxy

Here is an example nginx configuration that sets up the Web Application Server and also routes the /jupyter endpoint to the Jupyter component:

server {
listen 80;
server_name localhost 0.0.0.0;
client_max_body_size 100m;
gzip on;
gzip_vary on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/javascript application/xml application/json ;
gzip_disable "MSIE [1-6]\.";
location / {
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 Host $http_host;
proxy_pass http://localhost:5002;
proxy_read_timeout 3600;
}
location /jupyter {
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 Host $http_host;
proxy_pass http://localhost:5003;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}