Centos7 Install Nginx+fastdfs

Source: Internet
Author: User

Description: Centos7 single-machine deployment Nginx Fastdfs

# # Create a directory as a path to store data pictures you can define yourself

Mkdir-pv/data/application/{storage,tracker,client}

cd/data/application/

Yum install lrzsz wget git gcc gcc-c++ zlib-devel cmake make

git clone [email protected]:happyfish100/libfastcommon.git

git clone [email protected]:happyfish100/fastdfs.git

git clone [email protected]:happyfish100/fastdfs-nginx-module.git

wget http://nginx.org/download/nginx-1.9.4.tar.gz

Tar XF nginx-1.9.4.tar.gz-c/usr/local

cd/usr/local/nginx-1.9.4

# # # compiled Nginx check the compilation process of the missing package in time to install to ensure the smooth implementation of the compilation

./configure--prefix=/usr/local/nginx--add-module=/data/application/fastdfs-nginx-module && Make & & Make Install

CD.; RM-RF nginx-1.9.4

Cp/etc/fdfs/storage.conf.sample/etc/fdfs/storage.conf;cp/etc/fdfs/tracker.conf.sample/etc/fdfs/tracker.conf

# # # Description: The following 2 lines replace the saved data for the previously created directory and can be customized to your own requirements

Sed-i ' [email protected]^base_path.* @base_path =/data/application/[email protected] '/etc/fdfs/tracker.conf

Sed-i ' [email protected]_path0=.* @store_path0 =/data/application/[email protected] '/etc/fdfs/storage.conf

# # # Description: Do the following when you need to change the IP address to its own host address in order to not error

Sed-i ' s$^tracker_server=.* $tracker _server=172.17.0.2:22122$g ' storage.conf

# # # Start tracker server late reboot directly behind and restart can

# # # After you start remember to check Port 22122

' Which Fdfs_trackerd '/etc/fdfs/tracker.conf

# # # Start storage server late reboot directly behind and restart can

' Which fdfs_storaged '/etc/fdfs/storage.conf

# # # After you start remember to check port 23000

################# Nginx Start

/usr/local/nginx/sbin/nginx-t;/usr/local/nginx/sbin/nginx

# # # Check Nginx process found no woker processes only Master

ps-elf | grep nginx

# # # View Nginx error log

# # # # found the following error

[2018-10-12 07:11:48] ERROR-FILE:SHARED_FUNC.C, line:1067, file/etc/fdfs/mod_fastdfs.conf not exist
[2018-10-12 07:11:48] Error-file:/DATA/APPLICATION/FASTDFS-NGINX-MODULE/SRC/COMMON.C, line:163, load conf file "/etc/fdfs/mod_ Fastdfs.conf "fail, ret Code:2
2018/10/12 07:11:48 [alert] 4447#0:worker process 4448 exited with fatal code 2 and cannot being respawned

# # # Solution Find this file to copy to the/etc/fdfs/directory

CP ' Find/-name mod_fastdfs.conf '/etc/fdfs/

# # # overloaded Nginx View error

/usr/local/nginx/sbin/nginx-s Reload

# # # found the following error

[2018-10-12 08:39:59] ERROR-FILE:INI_FILE_READER.C, line:1029, include file "http.conf" not exists, line: "#include http.conf"
[2018-10-12 08:39:59] Error-file:/DATA/APPLICATION/FASTDFS-NGINX-MODULE/SRC/COMMON.C, line:163, load conf file "/etc/fdfs/mod_ Fastdfs.conf "fail, ret Code:2
2018/10/12 08:39:59 [Alert] 4447#0:worker process 4600 exited with fatal code 2 and cannot being respawned

# # # Solution Find this error prompt file http.conf Copy to the/etc/fdfs/directory

CP ' Find/-name http.conf '/etc/fdfs/

# # # Restart Nginx continue to view the error log

/usr/local/nginx/sbin/nginx-s Reload

# # # # found the following error

2018/10/12 08:44:48 [notice] 4609#0:signal process started
Ngx_http_fastdfs_process_init pid=4610
[2018-10-12 08:44:48] ERROR-FILE:SHARED_FUNC.C, line:1067, file/etc/fdfs/mime.types not exist
2018/10/12 08:44:48 [alert] 4447#0:worker process 4610 exited with fatal code 2 and cannot being respawned

# # # directly in the/data directory to find this file copied to the/etc/fdfs/directory

CP ' Find/data-name mime.types '/etc/fdfs/

# # # Modify/etc/fdfs/mod_fastdfs.conf configuration file with Nginx

Sed-i ' [email protected]^tracker_server=.* @tracker_server =172.17.0.2:[email protected] '/etc/fdfs/mod_fastdfs.conf

Sed-i ' [email protected]^url_have_group_name.* @url_have_group_name = [email protected] '/etc/fdfs/mod_fastdfs.conf

Sed-i ' [email protected]^store_path0=.* @store_path0 =/data/application/[email protected] '/etc/fdfs/mod_ Fastdfs.conf

Sed-i ' $a \ #include http.conf '/etc/fdfs/mod_fastdfs.conf

# # # This step to see your hobby execute delete extra rows

Sed-i '/^ *#/d '/usr/local/nginx/conf/nginx.conf

/usr/local/nginx/sbin/nginx-s Reload

# # # # # # # # # # # # # # # # # error log no errors

# # # Upload picture Test modify/etc/fdfs/client.conf file IP to replace its own host address

Sed-i ' [email protected]_path=.* @base_path =/data/application/[email protected] '/etc/fdfs/client.conf

Sed-i ' [email protected]_server=.* @tracker_server =172.17.0.2:[email protected] '/etc/fdfs/client.conf

Centos7 Install Nginx+fastdfs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.