1、  系统环境Windows 10

2、  设置静态站点目录,注意不要出现中文(这里踩了很多坑,可以查看错误日志error.log,

  “No mapping for the Unicode character exists in the target multi-byte code page”)

        nginx配置http静态站点服务器

这里测试了一下目录

3、  配置nginx.conf

 server {

      listen        9001;

      server_name   localhost;

      access_log       logs/access/9001.log; #off;不记录请求日志

      charset              utf-8;

     

      location /{

               root E:/local/nginx/sites/9001;

      }       

      location /download/{

               root E:/local/nginx/sites/9001;

               autoindex         on;

               autoindex_exact_size      off;

               autoindex_localtime        on; 

      }

      error_page       404  ../404page/index.html;

}

 

监听端口:9001

站点目录:E:/local/nginx/sites/9001;

设置可以浏览目录的路径:download

404:跳转到指定404页面

 nginx配置http静态站点服务器

中文目录和文件名会乱码,在Windows下暂时没找到决解方法。

 

相关文章:

  • 2021-06-01
  • 2021-04-06
  • 2021-12-08
  • 2021-05-27
  • 2021-06-20
猜你喜欢
  • 2022-01-21
  • 2021-11-30
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
相关资源
相似解决方案