fastdfs nginx 安装

Caleb0 2019-05-07

fastdfs nginx 安装

0.准备

关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)


service iptables stop  #临时关闭防火墙
chkconfig iptables off #永久关闭防火墙

1.依赖文件

fastdfs-nginx-module_v1.16.tar.gz  
FastDFS_v5.05.tar.gz    
libfastcommon-master.zip  
nginx-1.8.0.tar.gz

2.安装编译类库

yum install -y gcc gcc-c++
yum -y install libevent

yum install -y pcre pcre-devel zlib  zlib-devel openssl openssl-devel

3.安装 安装libfastcommon

upzip  libfastcommon-master.zip
mv libfastcommon-master/*  /usr/local/libfastcommon

cd /usr/local/libfastcommon
./make.sh           #编译
./make.sh install   #安装

4. 安装tracker

tar -zxvf FastDFS_v5.05.tar.gz -C /usr/local

cd /usr/local/FastDFS/
./make.sh && ./make.sh install  #编译之后接着进行安装

cp /usr/local/FastDFS/conf/* /etc/fdfs/
cd /etc/fdfs/
cp tracker.conf.sample tracker.conf

base_path=/home/yuqing/fastdfs  改为:  base_path=/home/fastdfs

base_path=/home/fastdfs
http.server_port=80

mkdir -p /home/fastdfs

启动
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

5.安装storage

cd  /etc/fdfs/
cp storage.conf.sample storage.conf

base_path=/home/yuqing/fastdfs    改为:  base_path=/home/fastdfs

store_path0=/home/yuqing/fastdfs  改为: store_path0=/home/fdfs_storage 

tracker_server=192.168.172.20:22122

http.server_port=88


mkdir /home/fdfs_storage


启动
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

6.测试 fastdfs 上传

base_path=/home/yuqing/fastdfs    改为:  base_path=/home/fastdfs
tracker_server=192.168.172.20:22122

测试
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/baoyou/1.jpg

7.在tracker/storage 上安装 nginx

tar -zxvf fastdfs-nginx-module_v1.16.tar.gz -C /usr/local

cd /usr/local/fastdfs-nginx-module/src/

修改config文件,将文件中的所有 /usr/local/ 路径改为 /usr/

cp mod_fastdfs.conf /etc/fdfs/

vi /etc/fdfs/mod_fastdfs.conf



base_path=/home/fastdfs
tracker_server=10.156.235.185
url_have_group_name=true        #url中包含group名称
store_path0=/home/fdfs_storage  #指定文件存储路径(上面配置的store路径)

cp /usr/lib64/libfdfsclient.so /usr/lib/

8.安装 nginx

tar -zxvf nginx-1.8.0.tar.gz -C /usr/local/ 

cd /usr/local/nginx-1.8.0/


./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi \
--add-module=/usr/local/fastdfs-nginx-module/src


make && make install


cd /usr/local/FastDFS/conf
cp http.conf mime.types /etc/fdfs/



mkdir /usr/local/nginx/logs  
cd /usr/local/nginx/conf/
vim nginx.conf


pid /usr/local/nginx/logs/nginx.pid;

        server_name  10.156.235.185; 

        location /group1/M00 {
            root   /home/fdfs_storage/data;
            ngx_fastdfs_module;
        }


nginx的启动
cd /usr/local/nginx/sbin/
./nginx

捐助开发者 

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。


fastdfs nginx 安装fastdfs nginx 安装fastdfs nginx 安装
 
 
 谢谢您的赞助,我会做的更好!

相关推荐

huhuhuemail / 0评论 2019-02-16