加入收藏 | 设为首页 | 会员中心 | 我要投稿 河北网 (https://www.hebeiwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 创业 > 正文

通过nginx为forever-webui添加密码验证 实现外部管理

发布时间:2018-10-07 09:46:52 所属栏目:创业 来源:站长网
导读:默认安装forever-webui是不能通过外网会见的,且进入打点界面也不必要暗码 信托许多同窗都必要在外部收集打点本身的nodejs处事~ 于是乎想把forever-webui添加一个暗码验证~ 小弟鄙人,对nodejs还没玩透,正巧之前是行使nginx端口转发来实现多域名绑定的

默认安装forever-webui是不能通过外网会见的,且进入打点界面也不必要暗码

信托许多同窗都必要在外部收集打点本身的nodejs处事~

于是乎想把forever-webui添加一个暗码验证~

小弟鄙人,对nodejs还没玩透,正巧之前是行使nginx端口转发来实现多域名绑定的

以是这次也通过nginx来在中间加一层暗码验证~

分为2步:
1.天生auth文件
参考该文:http://www.vpser.net/build/nginx-htpasswd.html

执行:wget -c soft.vpser.net/lnmp/ext/htpasswd.sh;bash htpasswd.sh

按提醒输入用户名、暗码、及认证文件名。剧本会自动天生认证文件。记录下剧本返回的文件路径。如:/usr/local/nginx/conf/vpser.net.auth。

通过nginx为forever-webui添加暗码验证 实现外部打点

2.修改nginx conf文件

修改nginx设置文件 我这里是用的vhost

upstream app_node_hello {
    server 127.0.0.1:8085;#署理forever-webui的端口
}

# the nginx server instance
server {
    listen 0.0.0.0:80;
    server_name nodejs.uedpark.com;
    # pass the request to the node.js server with the correct headers and much more can be added, see nginx config options
    location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;

      proxy_pass http://app_node_hello/;
      proxy_redirect off;
#添加验证
 auth_basic "plese input forever web UI password:";
 auth_basic_user_file /usr/local/nginx/conf/my.auth.conf;
    }
 }

然后reload或restart nginx~
再次会见forever-webui 表现如下

通过nginx为forever-webui添加暗码验证 实现外部打点

至此,为forever-webui添加暗码验证完成~没有什么难度,只是提供一种思绪罢了~
接待各人交换分享~

参考资料:http://www.veryhuo.com/a/view/43018.html

(编辑:河北网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读