# windows文件服务器配置
server {
listen 3333;
server_name localhost;
charset utf-8;
location / {
root html;
index index.html index.htm;
}
# 浏览器打开路径:localhost:8089(listen端口)/location设置的路径/图片名字.后缀
location ~ /picture/\.(gif|jpg|jpeg|png|JPG|PNG)$ {
# 图片保存在电脑的地址
root D:/picture;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
用localhost也可以
server {
listen 85;
server_name 10.39.16.96;
#charset koi8-r;
# access_log logs/host.access.log main;
location ~ .*\.(gif|jpg|pdf|jpeg|png)$
{
#root D:/nginx-1.15.5/temp/images/;#指定图片存放路径(可以放在nginx文件夹路径里也可以放其他盘)
root D:/picture/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
访问路径
http://10.39.16.96:85/The5_20200616145741c2964fe1659a401ebeed81bf7a298216.jpg