Nginx configuration fastdfs-nginx-module module
The first part introduces the installation of FastDFS, here is mainly to install the fastdfs-nginx-module module for NG to complete the upload and download of FastDFS
Install Nginx and fastdfs-nginx-module [root@EST-01 softwares] # wget-c https://nginx.org/download/nginx-1.10.1.tar.gzfastdfs-nginx-module directly using the There seems to be a lot of problems with downloads on the Internet [root@EST-01 softwares] # tar-zxvf nginx-1.10.1.tar.gz [root@TEST-01 softwares] # unzip fastdfs-nginx-module-master.zip [root@TEST-01 softwares] # cd nginx-1.10.1 [root@TEST-01 nginx-1.10.1] #. / configure-- add-module=../fastdfs-nginx-module-master/src/ [root@TEST-01 nginx-1 .10.1] # make[ root @ TEST-01 nginx-1.10.1] # make install [root @ TEST-01 nginx-1.10.1] # cd / usr/local/nginx/ We can take a look at the successfully installed version and module under Nginx [root@TEST-01 nginx] # sbin/nginx-Vnginx version: nginx/1.10.1built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) configure arguments:-- add- Module=../fastdfs-nginx-module-master/src/
Configure fastdfs-nginx-module and Nginx [root @ TEST-01 nginx] # cp / data/softwares/fastdfs-nginx-module-master/src/mod_fastdfs.conf / etc/fdfs/ [root @ TEST-01 nginx] # vi / etc/fdfs/mod_fastdfs.conf (modify the following three points). Tracker_server=192.168.12.102:22122.url_have_group_name = true.store_path0=/data/fastdfs/storage.... Copy related files to / etc/ fdfs [root @ TEST-01 nginx] # cp / data/softwares/fastdfs-5.05/conf/anti-steal.jpg / etc/fdfs/ [root @ TEST-01 nginx] # cp / data/softwares/fastdfs-5.05/conf/http.conf / etc/fdfs/ [root @ TEST-01 nginx] # cp / data/softwares/fastdfs-5.05/conf/mime.types / etc/fdfs/
Edit nginx.conf [root@TEST-01 nginx] # vi conf/nginx.conf. Location / group1/M00 {root / data/fastdfs/storage/; ngx_fastdfs_module;}. [root@TEST-01 nginx] # mkdir / data/fastdfs/storage/data/ group1 [root @ TEST-01 nginx] # ln-s / data/fastdfs/storage/data/ data/fastdfs/storage/data/group1/M00 launch nginx [root @ TEST-01 nginx] # sbin/nginx ngx_http_fastdfs_set pid=17697
This completes the Nginx configuration fastdfs-nginx-module module
Test:
Open upload [root@TEST-01 nginx] # cd / etc/fdfs/ [root @ TEST-01 fdfs] # cp client.conf.sample client.conf.# the base path to store log filesbase_path=/data/fastdfs# tracker_server can ocur more than once, and tracker_server format is# "host:port", host can be hostname or ip addresstracker_server=192.168.12.102:22122. Okay, Try uploading a picture [root@TEST-01 fdfs] # fdfs_test / etc/fdfs/client.conf upload / tmp/Tulips.jpgThis is FastDFS client test program v5.05Copyright (C) 2008, Happy Fish / YuQingFastDFS may be copied only under the terms of the GNU GeneralPublic License V3, which may be found in the FastDFS source kit.Please visit the FastDFS Home Page http://www.csource.org/ for more detail. [2017-06-23 09:38:47] DEBUG-base_path=/data/fastdfs, connect_timeout=30, network_timeout=60, tracker_server_count=1 Anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0tracker_query_storage_store_list_without_group: server 1. Group_name=, ip_addr=192.168.12.102, port=23000group_name=group1, ip_addr=192.168.12.102, port=23000storage_upload_by_filenamegroup_name=group1 Remote_filename=M00/00/00/wKgMZllMcSeAb4ChAAl5WLU-YRY168.jpgsource ip address: 192.168.12.102file timestamp=2017-06-23 09:38:47file size=620888file crc32=3040764182example file url: http://192.168.12.102/group1/M00/00/00/wKgMZllMcSeAb4ChAAl5WLU-YRY168.jpgstorage_upload_slave_by_filenamegroup_name=group1, Remote_filename=M00/00/00/wKgMZllMcSeAb4ChAAl5WLU-YRY168_big.jpgsource ip address: 192.168.12.102file timestamp=2017-06-23 09:38:47file size=620888file crc32=3040764182example file url: after http://192.168.12.102/group1/M00/00/00/wKgMZllMcSeAb4ChAAl5WLU-YRY168_big.jpg upload The URL of the picture will also appear. Let's visit it and try it.
Attachment: http://down.51cto.com/data/2366780