AMH-Nginx实战之让用户通过用户名密码认证访问web站点
[root@scholar~]# uname –r //查看系统内核版本号
2.6.32-042stab104.1
[root@scholar~]#cat /etc/centos-release
CentOS release 6.5 (Final)
server {
listen 80; #listen end
server_name amh.sh; #server_name end
index index.html index.htm index.php; #index endauth_basic "secret"; //虚拟主机认证命名
auth_basic_user_file /home/wwwroot/lngx_name/domain/amh.sh/passwd.db;
root /home/wwwroot/lngx_name/domain/amh.sh/web; #root end
include /home/wwwroot/lngx_name/rewrite/amh.conf; #rewrite endproxy_cache lngx_name; #proxy_cache end
proxy_temp_path /home/wwwroot/lngx_name/cache_temp;
proxy_cache_key $scheme://$host$request_uri;
proxy_cache_valid 200 304 12h; #cache_valid end
proxy_connect_timeout 60s; #connect_timeout end
location / {
default_type text/html;
subs_filter_types text/css text/xml; #subs_filtert end
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Referer http://code.amh.sh; #header_referer end
proxy_set_header Host code.amh.sh; #header_host end
proxy_pass http://code.amh.sh; #proxy_pass end
proxy_set_header Accept-Encoding "";
}access_log off; #access_log end
error_log /dev/null; #error_log end
}