Nginx access gateway
Jump to navigation
Jump to search
NGINX Tiny access gateway
nginx.conf
error_log /dev/stdout info; # error_log stderr; worker_processes 1; daemon off; pid /tmp/nginx.pid; events { } http { access_log /dev/stdout; server { listen 18443; server_name example.org; location / { if ($arg_key != "foo"){ add_header Content-Type text/plain; return 401 'Access Denied'; } proxy_pass https://example.org; } } }
Run
nginx -t $(pwd)/nginx.conf nginx -c $(pwd)/nginx.conf
Note
# proxy_set_header Host $host; # 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;