worker_processes auto; pid /tmp/nginx.pid; error_log /dev/stderr info; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log /dev/stdout; sendfile on; tcp_nopush on; client_body_temp_path /tmp/nginx/client_body; proxy_temp_path /tmp/nginx/proxy; map $http_upgrade $connection_upgrade { default upgrade; '' close; } map $http_upgrade $is_websocket { default 1; '' 0; } server { listen 8080; server_name _; root /opt/selkies-web; index index.html; auth_basic "Selkies"; auth_basic_user_file /tmp/selkies.htpasswd; location / { error_page 418 = @selkies_websocket; if ($is_websocket) { return 418; } try_files $uri $uri/ /index.html; } location @selkies_websocket { proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_set_header Authorization $http_authorization; 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_read_timeout 86400s; proxy_send_timeout 86400s; proxy_connect_timeout 30s; proxy_buffering off; } } }