Build FastDFS + Nginx in Linux
Build FastDFS + Nginx in Linux
FastDfs depends on libevent.
Prerequisites:
1. test environment directory:/home/users/wangyanpei/
2. libevent version: 2.0.21-stable
3. Fastdfs version: FastDFS_v4.06.tar.gz
4. Nginx version: 1.6.0
5. fastdfs-nginx-module version: fastdfs-nginx-module_v1.15.tar.gz
Installation path:
Nginx:/home/users/wangyanpei/nginx
Fastdfs:/home/users/wangyanpei/FastDFS
Tracker path:/home/users/wangyanpei/tracker/
Storage path:/home/users/wangyanpei/storage/
Libevent paths:/home/users/wangyanpei/libevent-2.0.21
Step 1: Install libevent:
Wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz put in/home/users/wangyanpei/setup/
Tar zxvf libevent-2.0.21-stable.tar.gz
Cd libevent-2.0.21-stable
./Configure -- prefix =/home/users/wangyanpei/libevent-2.0.21
Make & make install
Part 2: Install FastDFS
Wget http://fastdfs.googlecode.com/files/FastDFS_v4.06.tar.gz to/home/users/wangyanpei/setup/
Tar zxvf FastDFS_v4.06.tar.gz
Cd FastDFS
Vim make. sh [configure the installation path]
TARGET_PREFIX =/home/users/miaolinjie/FastDFS --- installation path
TARGET_CONF_PATH =/home/users/miaolinjie/FastDFS/conf --- configuration file path
WITH_LINUX_SERVICE = 1 --- whether it is a linux Service
../Make. sh C_INCLUDE_PATH =/home/users/wangyanpei/libevent-2.0.21/include LIBRARY_PATH =/home/users/miaolinjie/libevent-2.0.21/lib/
./Make install
Step 3: Install Nginx and fastdfs-nginx-module
Wget http://nginx.org/download/nginx-1.6.0.tar.gz
Wget http://fastdfs.googlecode.com/files/fastdfs-nginx-module_v1.15.tar.gz
To/home/users/wangyanpei/setup
Extract
Cd fastdfs-nginx-module/src/
Vim config [modify paths dependent on lib and include files]
CORE_INCS = "$ CORE_INCS/home/users/wangyanpei/FastDFS/include/fastdfs/home/users/wangyanpei/FastDFS/include/fastcommon /"
CORE_LIBS = "$ CORE_LIBS-L/home/users/wangyanpei/FastDFS/include/lib-lfastcommon-lfdfsclient"
CFLAGS = "$ CFLAGS-D_FILE_OFFSET_BITS = 64-bit = '2017 * 000000'-DFDFS_MOD_CONF_FILENAME = '\"/home/users/wangyanpei/FastDFS/conf/mod_fastdfs.conf \"'"
Copy the mod_fastdfs.conf file of fastdfs-nginx-module to the path specified in config:
Cp/home/users/wangyanpei/setup/fastdfs-nginx-module/src/mod_fastdfs.conf/home/users/miaolinjie/FastDFS/conf
Install Nginx:
Cd Nginx_1.6.0
. /Configure -- prefix =/home/users/wangyanpei/nginx -- conf-path =/home/users/wangyanpei/nginx/conf/nginx. conf -- add-module =/home/users/wangyanpei/setup/fastdfs-nginx-module/src/
Make & make install
If nginx cannot be started, copy the fastdfs directory to the corresponding directory.
./Sbin/nginx-c conf/nginx. conf
Step 4: configure the tracker server
Vim conf/tracker. conf
Bind_addr = Local ip Address
Base_path =/home/users/wangyanpei/tracker/[this directory stores information and logs that tracker knows]
Start:
./Bin/fdfs_trackerd./conf/tracker. conf
Step 5: configure the storage server
Vim conf/storage. conf
Group_name = group to which group1 belongs
Bind_addr
Base_path =/home/users/wangyanpei/storage
Store_path0 =/home/users/wangyanpei/storage
Tracker_server = ip: port
Http. server_port = 8090
Start
./Bin/fdfs_storaged./conf/storage. conf
Step 6: Modify mod_fastdfs.conf
Base_path =/home/users/wangyanpei/storage
Group_name = group1
Store_path0 =/home/users/wangyanpei/storage
Tracker_server = ip: port
Url_have_group_name = true
Step 7: Modify client. conf
Base_path =/home/users/wangyanpei/storage
Tracker_server = ip: port
Http. tracker_server_port = 8090
Step 8: Modify nginx. conf
Location/group1/M00 {
Root/home/users/wangyanpei/storage/data;
Ngx_fastdfs_module;
}
Restart nginx
Step 9: Test
./Bin/fdfs_test./conf/client. conf upload/etc/passwd
Result:
Tracker_query_storage_store_list_without_group:
Server 1. group_name =, ip_addr = 182.92.128.99, port = 23001
Group_name = group1, ip_addr = 182.92.128.99, port = 23001
Storage_upload_by_filename
Group_name = group1, remote_filename = M00/00/00/tlyAY1WJEWqAKulyAAAGPHfAkyI2479341
Source ip address: 182.92.128.99
File timestamp = 2015-06-23 15:57:30
Files size = 1596
File crc32 = 2009109282
File url: http: // 182.92.128.99: 8090/group1/M00/00/00/tlyAY1WJEWqAKulyAAAGPHfAkyI2479341
Storage_upload_slave_by_filename
Group_name = group1, remote_filename = M00/00/00/tlyAY1WJEWqAKulyAAAGPHfAkyI2479341_big
Source ip address: 182.92.128.99
File timestamp = 2015-06-23 15:57:30
Files size = 1596
File crc32 = 2009109282
File url: http: // 182.92.128.99: 8090/group1/M00/00/00/tlyAY1WJEWqAKulyAAAGPHfAkyI2479341_big
Open http: // 182.92.128.99: 8090/group1/M00/00/00/tlyAY1WJEWqAKulyAAAGPHfAkyI2479341_big in the browser to access the uploaded file.
Complete installation and configuration steps for fastDFS in CentOS 6.2
FastDFS installation in Ubuntu, PHP Client
Install, configure, and test the FastDFS Distributed File Server
FastDFS integration Nginx problem sorting
Build FastDFS in CentOS
Full record of FastDFS installation in Ubuntu
FastDFS details: click here
FastDFS: click here
This article permanently updates the link address: