1,配置文件nginx.conf
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location ^~ /static/ {
# 一定要用别名,不然不妨问不到
alias E:/soft/rar/nginx-1.18.0/static/;
}
2,创建文件夹及访问文件E:/soft/rar/nginx-1.18.0/static,在该文件夹下添加1.png图片
3,访问路径,localhost/static/1.png