浏览 3.5k
server {
auth_basic "Authentication Required";
auth_basic_user_file /etc/nginx/htpasswd.users;
location / {
proxy_pass http://192.168.72.209:5601;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_connect_timeout 300;
}
}
我把Nginx和上游的应用都安装在安装在同一台机器上了,使用相同的IP地址192.168.72.209,现在我通过IP地址进行访问,Nginx 密码认证框无法弹出。不知道什么原因。
自问自答了。看了一下代码,感觉ngx_http_compile_complex_value和ngx_http_script_compile是两套实现,前者对后者进行了封装,使用起来应该更方便。
比如,如果有一个指令需要支持复杂变量,使用ngx_http_compile_complex_value只需要定义一个ngx_http_complex_value_t变量就可以。但是使用ngx_http_script_compile需要定义flushes,lengths,variables一系列数组。。
微信公众号
加入微信群