Skip to content

This section described how to use nginx (https://nginx.org/en/) as a web server. 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 and the daemon should be running with the appropriate site configurations setup.

Here is an example nginx configuration:

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;
}
}

To setup a secure connection, update the /etc/httpd/sites-available/corridorapp.conf file as below:

<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /certs/app.crt
SSLCertificateKeyFile /certs/app.key
SSLCertificateChainFile /certs/ca.crt
ServerName www.corridorapp.com
ServerAlias corridorapp
ProxyPass / http://localhost:5002/
ProxyPassReverse / http://localhost:5002/
ErrorLog /var/www/corridorapp/log/error.log
CustomLog /var/www/corridorapp/log/requests.log combined
</VirtualHost>