Prepare the following tar package:
1 | 1 |
---|---|
fastdfs-6.06.tar.gz | - |
libfastcommon-1.0.43.tar.gz | - |
fastdfs-nginx-module-1.22.tar.gz | - |
nginx-1.17.7.tar.gz | - |
download link:
fastdfs-nginx-module,libfastcommon,fastdfs
1、 Use wget command to download the compressed package, if there is no wget command, use yum command to install
yum install wget
2、 Download fastdfs
wget -c "https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz" \
- O fastdfs-6.06.tar.gz
3、 Download libfastcommon
wget -c "https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz" \
- O libfastcommon-1.0.43.tar.gz
4、 Download fastdfs-nginx-module
wget -c "https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz" \
- O fastdfs-nginx-module-1.22.tar.gz
5、 Download nginx
wget -c http://nginx.org/download/nginx-1.17.7.tar.gz
6、 Install compilation tools and library files
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
7、 Turn off the firewall in the test environment
systemctl stop firewalld.service
8、 Disable firewall at boot
systemctl disable firewalld.service
9、 View firewall status
firewall-cmd --state
tar -zxvf fastdfs-6.06.tar.gz
tar -zxvf fastdfs-nginx-module-1.22.tar.gz
tar -zxvf libfastcommon-1.0.43.tar.gz
tar -zxvf nginx-1.17.7.tar.gz
1、 Enter the unzipped directory
cd /root/download/libfastcommon-1.0.43
2、 Compile and install
. /make.sh &&./make.sh install
3、 an examination
ls /usr/lib64|grep libfastcommon
ls /usr/lib|grep libfastcommon
It is successful if libfastcommon.so
appears
1、 Enter the unzipped directory
cd /root/download/fastdfs-6.06
2、 Compile and install
. /make.sh &&./make.sh install
3、 an examination
ls /usr/bin|grep fdfs
4、 Enable profile
cd /etc/fdfs/
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf
cp tracker.conf.sample tracker.conf
mkdir -p /fastdfs/tracker
5、 Modify the tracker.conf file
vi /etc/fdfs/tracker.conf
base_path = /fastdfs/tracker
6、 Start tracker service
/etc/init.d/fdfs_trackerd start
7、 Check if the service is started
ps -ef|grep fdfs`
8、 Modify the storage.conf file
vi /etc/fdfs/storage.conf
base_path = /fastdfs/storage store_path0 = /fastdfs/storageundefinedtracker_server = 192.168.0.154:22122
http.server_port = 80
9、 Create a directory
mkdir -p /fastdfs/storage
10、 Start storage service
/etc/init.d/fdfs_storaged start
11、 Set boot up
vi /etc/rc.d/rc.local
Join configuration
/etc/init.d/fdfs_trackerd startundefined/etc/init.d/fdfs_storaged start
12、 Edit the client.conf file
vi /etc/fdfs/client.conf
modify
base_path=/fastdfs/trackerundefinedtracker_server=192.168.0.154:22122
1、 Install pcre
yum -y install pcre pcre-devel
2、 Enter the unzipped directory
cd /root/download/nginx-1.17.7
3、 Add http_stub_status_module module
. /configure --prefix=/usr/local/nginx --with-http_stub_status_module
4、 Enter /root/download/fastdfs-nginx-module-1.22/src/
cd /root/download/fastdfs-nginx-module-1.22/src/
5、 Edit configuration file
vi config
6、 Replace /usr/local with /usr in the config file
: %s+/usr/local+/usr
7、 Enter the nginx decompression directory
cd /root/download/nginx-1.17.7
8、 Add fastdfs-nginx-module
. /configure --add-module=/root/download/fastdfs-nginx-module-1.22/src/
9、 Compile and install
make && make install
10、 Copy and modify the configuration file in fastdfs-ngin-module
cp /root/download/fastdfs-nginx-module-1.22/src/mod_fastdfs.conf /etc/fdfs/
vi /etc/fdfs/mod_fastdfs.conf
Change setting
connect_timeout=10undefinedtracker_server=192.168.0.154:22122
url_have_group_name = true
store_path0=/fastdfs/storage
11、 Enter the fastdfd source code conf directory
cd /root/download/fastdfs-6.06/conf/
11、 Copy the two files http.conf and mime.types to the /etc/fdfs/ directory
cp http.conf mime.types /etc/fdfs/
12、 Create a soft connection, create a soft connection in the /fastdfs/storagefile storage directory, and link it to the directory where the data is actually stored
ln -s /fastdfs/storage/data//fastdfs/storage/data/M00
13、 Edit nginx configuration
vi /usr/local/nginx/conf/nginx.conf
Change setting
server {
listen 80;
server_name 192.168.0.154;
location ~/group([0-9])/M00 {
root /fastdfs/storage/data;
ngx_fastdfs_module;}}
14、 Start nginx
/usr/local/nginx/sbin/nginx
1、 Download test picture to local
wget -c "https://gss0.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/zhidao/wh%3D600%2C800/sign=0f6379cdd8ca7bcb7d2ecf298e39475b/42a98226cffc1e17f7efcc3f4590f603738de968.jpg"-O boy.jpg
2、 Upload test image
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /root/download/boy.jpg
Get the return file name
group1/M00/00/00/wKgAml4RxbyARj9lAACxR4LEYRg912.jpg
Splicing with ip: http://192.168.0.154/group1/M00/00/00/wKgAml4RxbyARj9lAACxR4LEYRg912.jpg
Recommended Posts