aoirint's note

メモ帳(古い記事はkanomiya blogから移行)

nginx basic auth, reverse proxy, static files

Basic auth

        auth_basic "Authentication Required";
        auth_basic_user_file DIRECTORY/.htpasswd;

Reverse proxy

        proxy_set_header HOST $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location / {
                proxy_pass http://localhost:8000;
        }

Static files

        location /static/ {
                root PARENT_OF_STATIC_DIRECTORY;
        }