0
点赞
收藏
分享

微信扫一扫

Nginx搭建图片服务器

1.配置环境:
阿里云(Centos 6.8)
Nginx 1.10.2


2.如何搭建
如何安装Nginx在我上一篇文章里面已经有写了。
如何配置图片路径:


找到/etc/nginx/conf.d/default.cof

向default.conf添加这一段,其他不用改。


比如你的图片在/home/images
这时候你的代码就可以这样添加

  location / {
      root /home/images/;
      autoindex on;
    }
//也可以这样写
 location / images/{
      root /home/;
      autoindex on;
    }

结果访问该路径下的图片:



成功!

举报

相关推荐

0 条评论