events { worker_connections 1024; } http { server { listen 9000; server_name _; location / { proxy_pass http://127.0.0.1:8000; # auth_basic "Viewer Only"; # auth_basic_user_file .htpasswd; } location ~ /\. { deny all; } location ~ /edit$ { proxy_pass http://127.0.0.1:8000; auth_basic "Editor Only"; auth_basic_user_file .htpasswd; } # Example for mounting under /ethercalc location /ethercalc { return 301 $scheme://$server_name$request_uri/; } location /ethercalc/ { proxy_pass http://127.0.0.1:8000; rewrite /ethercalc(/.*) $1 break; } location /ethercalc/socket.io { proxy_pass http://127.0.0.1:8000; rewrite /ethercalc(/.*) $1 break; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; } } }