美文网首页
nginx实现简单的图片服务器(windows)+静态文件服务器

nginx实现简单的图片服务器(windows)+静态文件服务器

作者: 喜欢吹象的小孩 | 来源:发表于2019-04-18 17:02 被阅读0次

第一种:

root:会网访问url后面拼接配置的路径

配置实例如下:

location /images/ {
root html;
index index.html index.htm;
}
对于这种配置,直接访问http://localhost/images/1.jpg即可访问到images文件夹下的图片。

(访问路径会被指向http://localhost/html/images/1.jpg

第二种:

alias:直接指向目标文件的物理地址。

配置实例如下:

location /upload/ {
alias E:/ljdworkspace/nginx-1.12.2/nginx-1.12.2/html/images/;
autoindex on;
}
对于这种配置,直接访问http://localhost/upload/1.jpg 即可访问到E盘指定目录下的images文件夹里的图片。


作者:盐城吊霸天
来源:CSDN
原文:https://blog.csdn.net/qq_23974323/article/details/80067250
版权声明:本文为博主原创文章,转载请附上博文链接!

相关文章

网友评论

      本文标题:nginx实现简单的图片服务器(windows)+静态文件服务器

      本文链接:https://www.haomeiwen.com/subject/akbtgqtx.html