cuibobo

环境:一台客户机和一台nginx服务器

vim  /usr/local/nginx/conf/nginx.conf

server {
        listen       80;
        server_name  www.tarena.com;
        location / {
            root   web1;  #可以与下方auth_basic_user_file  "/usr/local/nginx/web1/pass.txt"目录不同
            index  index.html index.htm;
            allow all;  #允许所有地址访问
            deny 192.168.1.10;  #拒绝某个地址访问   
            auth_basic  "haha";   #开启加密功能
            auth_basic_user_file "/usr/local/nginx/web1/pass.txt";   #加密文件可不放在网页目录下,需要自己创建
        }
}

#/usr/local/nginx/sbin/nginx -s reload 

#htpasswd -c  /usr/local/nginx/web2/pass.txt  用户名

2、客户端访问:http://www.tarena.com

 

分类:

技术点:

相关文章:

  • 2021-06-21
  • 2022-01-02
  • 2021-05-29
  • 2021-06-28
  • 2021-11-01
  • 2022-01-02
  • 2021-09-21
猜你喜欢
  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-23
  • 2021-11-05
  • 2021-12-23
相关资源
相似解决方案