[nginx@new-mq-node pass]$ pwd
/usr/local/nginx/pass
[nginx@new-mq-node pass]$ perl -e 'print crypt(mqpass,mqpass)'
mqdhK69Oo2JQA[nginx@new-mq-node pass]$ vim mq.passwd
[nginx@new-mq-node pass]$ cat mq.passwd
mqmonitor:mqdhK69Oo2JQA
[nginx@new-mq-node pass]$
Note: 这里的认证密码要和mq中监控用户的一样,否则第一次正确输入后可以看到MQ的认证窗口,但在第二次认证过程中,nginx会到自己的基本认证文件中去找对应用户从而导致跳转失败,可以在错误日志中看到对应信息
[nginx@new-mq-node conf]$ tail nginx.conf | grep include
include apps/mq.conf;
[nginx@new-mq-node conf]$ cat apps/mq.conf
upstream mq {
server 192.168.66.123:15672;
}
server {
listen 1443;
server_name localhost;
ssl on;
ssl_certificate /usr/local/nginx/cert/es.crt;
ssl_certificate_key /usr/local/nginx/cert/es.key;
location / {
root html;
index index.html index.htm;
auth_basic "input your name and passsword for mq";
auth_basic_user_file /usr/local/nginx/pass/mq.passwd;
allow all;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://mq;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[nginx@new-mq-node conf]$
本文系转载,前往查看
如有侵权,请联系?cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系?cloudcommunity@tencent.com 删除。