Installation and Configuration FastDFS + nginx

FastDFS is a lightweight open source distributed file system implemented by the C language

 

 

Environmental centos7
mounting gcc yum install gcc-c ++ -y

2.libevent
yum -y install libevent
if no perl library, use the command yum install perl *-install
yum -y install zlib zlib-devel pcre pcre-devel gcc gcc-c ++ openssl openssl-devel libevent libevent-devel perl unzip net- tools wget

3. Install libfastcommon
upload archive file to libfastcommonV1.0.7.tar.gz under / usr / local directory, and unzip it.

tar -zxvf libfastcommonV1.0.7.tar.gz
compiled ./make.sh
installation ./make.sh install

libfastcommon After installing the library files are automatically copied to / usr / lib64, due FastDFS program references usr / lib directory so you need to copy the library files in / usr / lib64 to under / usr / lib

cp /usr/lib64/libfastcommon.so /usr/lib/


Installation tracker

Installation FastDFS_v5.05.tar.gz to / opt
tar -zxvf FastDFS_v5.05.tar.gz
cd FastDFS
./make.sh
./make.sh install
After successful installation, the files in the conf directory are copied to the installation / etc / fdfs / lower.
conf cd
cp * / etc / FDFS /

vim /etc/fdfs/client.conf
base_path=/opt/fastdfs
tracker_server=192.168.239.139:22122

 

 Modify the configuration file

vim /etc/fdfs/tracker.conf
base_path=/opt/fastdfs
mkdir /opt/fastdfs


Start Tracker
fdfs_trackerd /etc/fdfs/tracker.conf Start


FastDFS-storage configuration

vim /etc/fdfs/storage.conf

base_path=/opt/fastdfs
store_path0=/opt/fastdfs/fdfs_storage
tracker_server=192.168.239.139:22122

 

mkdir /opt/fastdfs/fdfs_storage

Start Storage
fdfs_storaged /etc/fdfs/storage.conf Start

 


FastDFS integrated nginx

Plug-in configuration

cd /opt

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

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

1.vi fastdfs-nginx-module/src/config


CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

2. The copy in the mod_fastdfs.conf FastDFS-nginx-module / src to / etc / FDFS /
[the root @ localhost the src] CP # mod_fastdfs.conf / etc / FDFS /

vim /etc/fdfs/mod_fastdfs.conf


base_path=/opt/fastdfs
tracker_server=192.168.239.139:22122
url_have_group_name = true
store_path0=/opt/fastdfs/fdfs_storage

 


install nginx

./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=/opt/fastdfs-nginx-module/src


2. Modify the nginx configuration file
Vi /nginx/conf/nginx.conf

server_name 192.168.239.139

location / group1 / M00 / {
ngx_fastdfs_module;
}


3.mkdir -p / var / temp / nginx / client to create nginx / client directory


cd sbin
./nginx

 

Upload Test

/ Usr / bin / fdfs_test /etc/fdfs/client.conf upload /root/abc.jpg

 

Guess you like

Origin www.cnblogs.com/quyangyang/p/11617944.html