Skip to content

nginx

Install the nginx package.

# apt update
# apt install nginx
# yum install epel-release
# yum install nginx
# yum install nginx

To serve the application, a new configuration file has to be created at /etc/nginx/conf.d/peering-manager.conf containing the following:

Debian specific

Debian also has the /etc/nginx/sites-enabled folder, where you can place your configuration files. It also places a default configuration there that you should remove.

IPv6

Replace http://127.0.0.1:8001 with http://[::1]:8001 if you have configured gunicorn to listen on the IPv6 loopback address.

server {
    listen 80;
    server_name peering.example.com;

    location / {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header X-Forwarded-Host $server_name;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /static {
        alias /opt/peering-manager/static;
    }
}

If you want to access Peering Manager on a path instead of root, you can alter the location statements accordingly. But you have also have to set the BASE_PATH setting to the same path.

After configuring, the nginx service has to be enabled and started:

# systemctl enable nginx --now

You now can access the application at the configured location. If you receive a 502 (bad gateway) error, your configuration may not be correct or the application server is not running.