您的位置:首页 > 运维架构 > Nginx

nginx允许指定IP免密码访问页面,其他密码验证访问

2015-04-30 14:35 1081 查看
更多内容可移驾至我的独立Blog:
http://www.justfbt.com/


关键配置

server {
#listen   80; ## listen for ipv4; this line is default and implied
#listen   [::]:80 default ipv6only=on; ## listen for ipv6

root /usr/share/nginx/phpmyadmin;
index index.php index.html index.htm;

# Make site accessible from http://localhost/ server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
satisfy any;  ###
allow 192.168.xxx.xx; ###
deny all;  ###

auth_basic "secret"; ###
auth_basic_user_file /usr/share/nginx/xxx/passwd.db; ###
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}

location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
deny all;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: