Two types of Nginx configuration user rights access

Source: Internet
Author: User
Tags crypt

There are two general commands for generating password files in Linux

Opensslpasswd-crypt passwd will generate a string after the file does not need

The other is

Htpasswd-c/etc/filename.db username

The user name is displayed in the password:

When the system shows that there is no htpasswd command, you can display the installed software after the input htpasswd (Ubuntu)

Finally post the configuration of my own nginx as a reference:

server {

Listen 9200;

server_name xxxxxxxx;

CharSet UTF8;

Auth_basic "Secret"; # #使用openssl Passwd-crypt Passwds The location of the configuration when encrypting

Auth_basic_user_file/etc/nginx/passwords; # #可以不需要文件后缀

Location/{

Proxy_pass http://xxxxxxxxxx;

Proxy_redirect default;

Proxy_connect_timeout 60;

Proxy_send_timeout 172800;

Proxy_read_timeout 6000;

Proxy_set_header Host $host;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

Proxy_buffering off;

Auth_basic "Secret"; # #使用htpasswd加密的时候配置的位置

auth_basic_user_file/etc/nginx/passwords.db;

Proxy_max_temp_file_size 0;

}

Error_page 502 503 504/50x.html;

Location =/50x.html {

root/usr/share/nginx/html;

}

}




This article from "East God to a dozen five" blog, declined reprint!

Two types of Nginx configuration user rights access

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.