centos7-FASTDFS安装(两分钟完成)
切换到home目录command:cd /home/
下载需要文件(到你自己的电脑,然后拉到home目录下) https://wwa.lanzous.com/b00tuv2cf
全部解压command:tar -zxvf fastdfs-nginx-module-1.20.tar.gz
command:nginx-1.15.2.tar.gz
command:V1.0.38.tar.gz
command:V5.11.tar.gz
command:cd libfastcommon-1.0.38
command:./make.sh(注意:如果报错command not fount gcc和make,command:yum -y install gcc make)
command:./make.sh install
command:cd ..
command:cd fastdfs-5.11
command:./make.sh
command:./make.sh install
command:cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
command:cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
command:vim /etc/fdfs/tracker.conf
修改内容自行查找:
base_path=/home/fastdfs/tracker(注意:如果目录不存在自行创建)
http.server_port=80
command:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
command:vim /etc/fdfs/storage.conf
修改内容自行查找:
base_path=/home/fastdfs/storage(注意:如果目录不存在自行创建)
store_path0=/home/fastdfs/storage
tracker_server=XXX:22122(XXX是centos的ip)
command:/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
command:/usr/bin/fdfs_monitor /etc/fdfs/storage.conf(查看storage是否绑定如果绑定会显示Storage1的内容,内容有ip_addr=(centos的ip))
command:cd /home/nginx-1.15.2/
command:./configure --prefix=/usr/local/nginx --add-module=/home/fastdfs-nginx-module-1.20/src
command:make (注意:如果报错:/usr/include/fastdfs/fdfs_define.h:15:27: fatal error: common_define.h: No such file or directory,修改文件内容,command: vim /home/fastdfs-nginx-module-1.20/src/config
修改内容自行查找:
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/")
command:make install
command:cp /home/fastdfs-nginx-module-1.20/src/mod_fastdfs.conf /etc/fdfs/
command:vim /etc/fdfs/mod_fastdfs.conf
修改内容自行查找:
base_path=/home/mm/fastdfs
tracker_server=XXX:22122(XXX是centos的ip)
url_have_group_name=true
store_path0=/home/fastdfs/storage(注意:如果目录不存在自行创建)
command:vim /usr/local/nginx/conf/nginx.conf
添加一下内容到server
location ~/M00{
root/home/fastdfs/storage/data;
ngx_fastdfs_module;
}
command:cp /home/fastdfs-5.11/conf/{anti-steal.jpg,http.conf,mime.types} /etc/fdfs
command:cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
command:vim /etc/fdfs/client.conf
修改内容自行查找:
base_path=/home/fastdfs/tracker
tracker_server=XXX:22122(XXX是centos的ip)
http.tracker_server_port=80
command:cd /etc/fdfs/
测试上传:
command:/usr/bin/fdfs_upload_file /etc/fdfs/client.conf client.conf(上传命令)
command:/usr/local/nginx/sbin/nginx
打开网页输入:http://centos的ip/group1/M00/00/00/wKgBZF9d6gKAba52AAAFtXJOjeo23.conf
group1/M00/00/00/wKgBZF9d6gKAba52AAAFtXJOjeo23.conf是上传后显示的文件地址