# /etc/nginx/sites-available/picam # Replace (four places). # Port 80: answer Let's Encrypt HTTP-01 challenges, redirect everything else. server { listen 80; server_name ; location /.well-known/acme-challenge/ { root /var/www/html; } location / { return 301 https://$host$request_uri; } } # Port 443: TLS, a password on everything, then route by path. server { listen 443 ssl; server_name ; ssl_certificate /etc/letsencrypt/live//fullchain.pem; ssl_certificate_key /etc/letsencrypt/live//privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; auth_basic "camera"; auth_basic_user_file /etc/nginx/picam.htpasswd; # Go streaming server: /stream/0 and /stream/1 location /stream/ { proxy_pass http://127.0.0.1:8081; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_buffering off; } # Flask: the page and /status location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; } }