Use nginx to add password verification for forever-webui for external management

Source: Internet
Author: User

By default, forever-webui installation is not accessible through the Internet, and you do not need a password to enter the management interface.

I believe that many developers need to manage their own nodejs services in the external network ~

I want to add a password for forever-webui ~

The younger brother is not good at nodejs yet. It happened that I used nginx port forwarding to bind multiple domain names.

So this time we also use nginx to add a password verification layer in the middle ~

There are two steps:
1. Generate the auth file
Reference: http://www.vpser.net/build/nginx-htpasswd.html

Run wget-c soft.vpser.net/lnmp/ext/htpasswd.shw.bash htpasswd. sh.

Enter the user name, password, and authentication file name as prompted. The script automatically generates the authentication file. Record the file path returned by the script. For example,/usr/local/nginx/conf/vpser.net. auth.

2. Modify the nginx conf file

Modify the nginx configuration file. Here we use vhost

Upstream app_node_hello {server 127.0.0.1: 8085; # proxy forever-webui port} # the nginx server instanceserver {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; # Add auth_basic "plese input forever web UI password :"; auth_basic_user_file/usr/local/nginx/conf/my. auth. conf ;}}

Then reload or restart nginx ~
Access forever-webui again.

So far, password verification is complete for forever-webui ~ There is no difficulty. It is just a way of thinking ~
You are welcome to share this article ~

References: http://www.bkjia.com/a/view/43018.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.