Using Nginx as a reverse proxy
This example is a deployment template. Replace the uppercase placeholders, such as $SERVER_DOMAIN and $SERVER_PORT, with your deployment values before loading it into Nginx. Add HTTPS/TLS configuration for production. See the supplied gateway template for the complete WebRTC and conferencing routes.
server {
listen 80;
listen [::]:80;
server_name $SERVER_DOMAIN;
client_max_body_size 0;
location / {
proxy_http_version 1.1;
proxy_read_timeout 360s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:$SERVER_PORT;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
location /videos/ {
gzip off;
gzip_static off;
proxy_buffering off;
tcp_nodelay On;
tcp_nopush On;
aio threads;
access_log off;
sendfile on;
sendfile_max_chunk 512k;
proxy_pass http://localhost:$VIDEO_SERVER_PORT/;
proxy_set_header Host $http_host;
}
location /supervisor/ {
proxy_pass http://localhost:$SUPERVISOR_PORT/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
location ~ /ws/(?<port>\d+) {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:$port/ws;
proxy_connect_timeout 1d;
proxy_send_timeout 1d;
proxy_read_timeout 1d;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}