• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
统哥
博客园    首页    新随笔    联系   管理    订阅  订阅

nginx配置http静态站点服务器

1、  系统环境Windows 10

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

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

        

这里测试了一下目录

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页面

 

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

 

posted @ 2019-07-29 18:02  统哥  阅读(545)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3