Installation Environment Centos Environment Dependency: yum -y install gcc yum install -y pcre pcre-devel yum install -y zlib zlib-devel yum install -y openssl openssl-devel # If you don't have make, you need to install make yum install -y make Installation and configuration process 1. Create a fastdfs directory: mkdir -p /fastdfs/tracker mkdir -p /fastdfs/storage mkdir -p /fastdfs/logs 1. Download and install libfastcomman (basic environment) wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz tar -zxvf V1.0.7.tar.gz cd libfastcommon-1.0.7 ./make.sh && ./make.sh install # Copy the file to solve the problem of lib configuration file path in FastDFS. cp /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so cp /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so 2. Download and install FastDFS. After the installation is complete, the default configuration file directory is: wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz tar -zxvf V5.05.tar.gz cd fastdfs-5.05/ ./make.sh && ./make.sh install 3. Configure tracker # Copy the configuration file to the /etc/fdfs directory cd .../fastdfs-5.05/conf cp * /etc/fdfs/ sudo vim tracker.conf Modify bath_path and configure it as follows: base_path=/fastdfs/tracker Start the tracker: fdfs_trackerd /etc/fdfs/tracker.conf start 4. Configure storage vim storage.conf Modify the configuration items and configure them as follows: #Log directory base_path=/fastdfs/storage #Storage directory store_path0=/fastdfs/storage #tracker node tracker_server=192.168.1.4:22122 Start storage: fdfs_storaged /etc/fdfs/storage.conf start 5. Configure the client vim-client.conf The configuration items are as follows: #tracker node tracker_server=192.168.1.4:22122 #Log path base_path=/fastdfs/logs 6. Install nginx and fastdfs-nginx-module. It is not recommended to use yum or apt to install nginx directly, because when installing the fastdfs-nginx-module module, it needs to be compiled again, which is very troublesome. # Download the fastdfs-nginx-module module cd /fastdfs wget https://github.com/happyfish100/fastdfs-nginx-module/archive/5e5f3566bbfa57418b5506aaefbe107a42c9fcb1.zip unzip 5e5f3566bbfa57418b5506aaefbe107a42c9fcb1.zip mv fastdfs-nginx-module-5e5f3566bbfa57418b5506aaefbe107a42c9fcb1 fastdfs-nginx-module # Download nginx wget http://nginx.org/download/nginx-1.12.1.tar.gz tar -zxvf nginx-1.12.1.tar.gz # Install nginx and fsatdfs-nginx-module cd nginx-1.12.1 ./configure --prefix=/opt/nginx --sbin-path=/usr/bin/nginx --add-module=/fastdfs/fastdfs-nginx-module/src make make install 7. Configure mod_fastdfs.conf file cd /fastdfs/fastdfs-nginx-module/src cp mod_fastdfs.conf /etc/fdfs/ vim /etc/fdfs/mod_fastdfs.conf The configuration items are as follows: connect_timeout=10 # Client access file connection timeout (unit: seconds) base_path=/fastdfs/tmp # Storage log path tracker_server=192.168.1.4:22122 # Tracker service IP and port url_have_group_name=true # Access link prefix plus group name group_name=group1 # One-to-one correspondence with storage groupname store_path0=/fastdfs/storage # File storage path 8. Configure nginx cd /opt/nginx/conf/ vim nginx.conf The configuration items are as follows, that is, when accessing resources starting with group1, they are handed over to fastdfs-nginx-module for processing: # Listen for domains with group0 to group9, and hand them over to the fastdfs-nginx-module module for processing location ~/group([0-9])/ { ngx_fastdfs_module; } test 1. Upload pictures fdfs_upload_file /etc/fdfs/client.conf ~/Desktop/test.png At this point a string will be returned to us. 2. Access the test, enter in the browser:
Access successful! This is the end of this article about how to build an image server with Nginx+FastDFS. For more information about building an image server with Nginx+FastDFS, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of using Vue custom tree control
>>: Tutorial on installing mysql-8.0.18-winx64 under Windows (with pictures and text)
A considerable number of websites use digital pagi...
Table of contents 1. Project construction 2: Dire...
In the previous article, we introduced the MySQL ...
When inserting a set of data into the MySQL datab...
1. Introduction Vagrant is a tool for building an...
Table of contents Why use day.js Moment.js Day.js...
1. Setting case sensitivity of fields in the tabl...
Table of contents 1. Pull the image 2. Create a R...
Mouse effects require the use of setTimeout to ge...
This article uses an example to describe how to c...
Table of contents 1. Create a table 1.1 Create te...
Table of contents 1. Overview 2. Use docker to de...
MySQL 5.7 version: Method 1: Use the SET PASSWORD...
Question: In index.html, iframe introduces son.htm...
HTML is a hybrid language used for publishing on ...