在制作网站、小程序或者APP时,肯定离不开图片的,那么这些图片存放在什么位置?怎么存放?又如何展示呢,那么,这篇文章手把手带你搭建一台属于自己的图片服务器。
话不多说,上号,不对,是上代码:
所需工具:Linux系统+FastDFS+Nginx
1.依赖环境下载
系统: vagrant(centos7)
-
yum install -y gcc-c++ #需要依赖gcc
-
yum install -y pcre #用于支持rewrite模块 pcre-8.32-17
-
yum install -y libevent #FastDFS依赖libevent库 libevent-2.0.21-4.el7.x86_64
-
yum install -y zlib zlib-devel #用于支持gzip模块 zlib-1.2.7-17.el7.x86_64
-
libfastcommon-master.zip #libfastcommon包含了FastDFS运行所需要的一些基础库https://github.com/happyfish100/libfastcommon/releases
-
fastdfs-nginx-module-master.zip # https://codeload.github.com/happyfish100/fastdfs-nginx-module/zip/master
-
FastDFS版本:fastdfs-5.11.zip #https://github.com/happyfish100/fastdfs/archive/V5.11.zip
-
Nginx版本:nginx-1.14.tar.gz : #官网下载: http://nginx.org/en/download.html
2.安装libfastcommon
unzip libfastcommon-1.0.39.zipmv libfastcommon-1.0.39 /usr/local/libfastcommoncd /usr/local/libfastcommon/./make.sh #编译./make.sh install #安装# 检查确认/usr/lib64 和 /usr/lib 目录下都生成了 libfastcommon.so (有些版本可能/usr/lib下不会生成)ls /usr/lib64 | grep libfastcommon.sols /usr/lib | grep libfastcommon.so
3.安装tracker
cd /downloadunzip fastdfs-5.11.zipmv fastdfs-5.11 /usr/local/FastDFScd /usr/local/FastDFS/./make.sh && ./make.sh install #编译之后接着进行安装#确认安装成功,没有报错后,拷贝配置文件到/etc/fdfs</

本文详细介绍了如何在Linux系统(CentOS7)上免费搭建自己的图片服务器,通过FastDFS和Nginx的整合,实现图片上传与访问。步骤包括依赖环境的安装、libfastcommon、tracker、storage的配置,以及FastDFS和Nginx的整合,最终实现在项目中便捷使用FastDFS的功能。
最低0.47元/天 解锁文章
1669

被折叠的 条评论
为什么被折叠?



