开启文件目录
server {
            listen  80;
           #设置自己静态目录的访问域名    
            server_name  xxx.xxxx.com;
           #防止页面中文乱码一定要在utf-8前面加上gbk,顺序很重要    
            charset utf-8;
           
            location / {
             #静态目录的绝对位置    
            root /file/statics;
              #Nginx默认是不允许列出整个目录的,打开需要加上
               autoindex on; 
              #显示出文件的确切大小,单位是bytes
               autoindex_exact_size on; 
               #改为on后,显示的文件时间为文件的服务器时间
               autoindex_localtime on; 
          }
       }    


加密访问

创建密码文件和用户密码
将配置文件发在/etc/nginx/conf.d/
cd  /etc/nginx/conf.d/
htpasswd -c .htpasswd  quan  #输出2004密码

在server区域加入

#设置密码文件
    auth_basic            "提示语";
    auth_basic_user_file  /etc/nginx/conf.d/.htpasswd;

相关文章:

  • 2021-10-13
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
猜你喜欢
  • 2021-10-11
  • 2021-12-27
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
相关资源
相似解决方案