node.js - Node .js server with nginx and basic auth -


i'm trying run node.js server behind nginx, basic auth. here minimal config:

server {   auth_basic "closed website";   auth_basic_user_file /etc/nginx/.htpasswd;    location / {     proxy_pass  http://localhost:3000/;     proxy_set_header host $host;     proxy_set_header x-real-ip $remote_addr;     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;   } } 

my first problem when go x.x.x.x, basic auth form re-appears every time (indefinitely) hit enter (whatever set login , password - ones).

the server returns plain text res.end("hello world\n");, can see second before basic auth form appears again.

second question, possible block x.x.x.x:3000 (if not, there no point in setting auth on :80).

thanks!

btw it's first time setup nginx (and spent quite lot of time on already).

note: works without basic auth (or auth_basic off; in location).

currently website looks that: enter image description here :)

ok bad, got it!

apparently passwords in .htpasswd have encrypted, openssl passwd worked fine.

the second question easy one, iptables there that.

hope might other new users of nginx!


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -