楔子
在window 使用nginx 搭建一个测试使用的图片服务器。方便测试使用。
nginx配置
server {
listen 99;
server_name localhost;
# 访问的时候 url 最后是"img/",注意下图 区别。window上为了避免中文文件夹显示得问题,最好不要用中文
location /img/{
#开启文件目录
autoindex on;
alias D:/pics/ ;# 文件路径 注意不要忘记最后面的斜杆。或者文件路径写成d:\\pic\\img\\
index 110.png 1.jpg;
}
}
效果
nginx
windows的nginx
#测试配置文件是否正确配置
nginx.exe -t
#重新加载配置文件
nginx.exe -s reload
#停止 nginx
nginx.exe -s stop