2020-03-07

2020-03-07  本文已影响0人  敲到顺为止

nginx+fastdfs安装

1.准备部署安装包

(将所有包放到/usr/local/page目录下,pape是自己命名创建的目录)

FastDFS_v5.08.tar.gz

fastdfs-nginx-module_v1.16.tar.gz

libevent-2.0.20-stable.tar.gz

libfastcommon-1.0.36.tar.gz

nginx-1.17.6.tar.gz

nginx-http-concat-master.zip

openssl-1.0.2j.tar.gz

pcre-8.39.tar.gz

zlib-1.2.11.tar.gz

2.安装开始

###先安装fastdfs

cd /usr/local/page

tar -zxvf libevent-2.0.20-stable.tar.gz

tar -zxvf libfastcommon-1.0.36.tar.gz

tar -xvf FastDFS_v5.08.tar.gz

cd libevent-2.0.20-stable

./configure --prefix=/usr/local/libevent-2.0.20

make

make install

cd /usr/local/page/libfastcommon-1.0.36

sh make.sh

sh make.sh install

cd /usr/local/page/FastDFS

./make.sh

./make.sh install

cd /etc/fdfs

mv storage.conf.sample storage.conf

mv tracker.conf.sample tracker.conf

mkdir -p /data/fastdfs

cp /etc/fdfs/tracker.conf /etc/fdfs/tracker.conf.bak

cp /etc/fdfs/storage.conf /etc/fdfs/storage.conf.bak

sed -i 's/http.server_port=8080/http.server_port=8881/' /etc/fdfs/tracker.conf

sed -i 's/home\/yuqing\/fastdfs/data\/fastdfs/' /etc/fdfs/tracker.conf

sed -i 's/base_path=\/home\/yuqing\/fastdfs/base_path=\/data\/fastdfs/' /etc/fdfs/storage.conf

sed -i 's/store_path0=\/home\/yuqing\/fastdfs/store_path0=\/data\/fastdfs/' /etc/fdfs/storage.conf

sed -i 's/tracker_server=192.168.209.121:22122/tracker_server=tracker所在机器实际ip:22122/' /etc/fdfs/storage.conf

cp /usr/local/kernel/FastDFS/conf/http.conf /etc/fdfs

cp /usr/local/kernel/FastDFS/conf/mime.types /etc/fdfs

####启动fastdfs

/usr/bin/fdfs_monitor /etc/fdfs/storage.conf       ----先启动storage

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf       ----再启动tracker

####安装nginx

cd /usr/local/page

tar -zxvf nginx-1.17.6.tar.gz

tar -zxvf  openssl-1.0.2j.tar.gz

tar -zxvf  pcre-8.39.tar.gz

tar -zxvf  zlib-1.2.11.tar.gz

tar -xvf  fastdfs-nginx-module_v1.16.tar.gz

unzip  nginx-http-concat-master.zip

sed -i.bak 's/usr\/local\/include\/fastdfs \/usr\/local\/include\/fastcommon/usr\/include\/fastdfs \/usr\/include\/fastcommon/' /usr/local/kernel/fastdfs-nginx-module/src/config

cp /usr/local/page/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs

cp /etc/fdfs/mod_fastdfs.conf /etc/fdfs/mod_fastdfs.conf.bak

sed -i 's/tracker_server=tracker:22122/tracker_server=tracker所在机器实际ip:22122/'  /etc/fdfs/mod_fastdfs.conf

sed -i 's/store_path0=\/home\/yuqing\/fastdfs/store_path0=\/data\/fastdfs/'  /etc/fdfs/mod_fastdfs.conf

sed -i 's/url_have_group_name = false/url_have_group_name = true/'  /etc/fdfs/mod_fastdfs.conf

chmod 755 /etc/fdfs

chmod 755 /etc/fdfs/*

cd /usr/local/page/openssl-1.0.2j

./config

make

make install

cd /usr/local/page/zlib-1.2.11

./configure

make

make install

cd /usr/local/page/pcre-8.39

./configure

make

make install

cd /usr/local/page/nginx-1.17.6

./configure \

--prefix=/usr/local/nginx \

--with-stream \

--with-http_ssl_module \

--with-http_stub_status_module \

--with-pcre=../pcre-8.39 \

--with-zlib=../zlib-1.2.11 \

--with-openssl=../openssl-1.0.2j \

--add-module=../fastdfs-nginx-module/src \

--add-module=../nginx-http-concat-master

make

make install

sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

###启动nginx

/usr/local/nginx/sbin/nginx

3.相关命令

/usr/local/nginx/sbin/nginx  ---启动nginx

/usr/local/nginx/sbin/nginx -s reload   ---重启nginx

/usr/bin/fdfs_test /etc/fdfs/client.conf upload t1.jpg    ----fastdfs手动上传图片,前提要配合/etc/fdfs/client.conf里边的tracker ip

/usr/bin/fdfs_monitor /etc/fdfs/client.conf          ---查看fdfs状态

上一篇下一篇

猜你喜欢

热点阅读