Fastdfs Install extension--install PHP, Apache and nginx fastdfs extension "all Fastdfs documents"

Source: Internet
Author: User
Tags install php

FASTDFS Installation extension--Installation of PHP, Apache and Nginx Fastdfs extensions

Company project preparation with Fastdfs START I do not know what this means, busy for one weeks before the general understanding, and then configure the use, all things are never understand, if you have to face him bravely. The thing is lets the person use, one weeks not to use, spends one months of time, as long as diligently study, certainly will prevail!

For more information on how to install Fastdfs under Linux, please refer to: http://www.icultivator.com/p/4843.html

First, install the configuration Fastdfs support PHP

Fastdfs is not a universal file system, it can only be accessed through a dedicated API, now provides the C JAVA PHP API, below we install the PHP extension. Let Fastdfs support PHP, after the FASTDFS source package decompression inside there is a php_client directory, enter this directory, refer to the Readme installation:

Phpize./configuremakemake Install

When the installation is complete, the modules/fastdfs_client.so will be copied to the/usr/lib/php5/20090626 directory automatically, only fastdfs_client.ini copy to/etc/php5/ CONF.D directory, the implementation of PHP fastdfs_test.php test, PHP5-M will also see the Fastdfs_client module, in the Readme also has the relevant PHP function interpretation, can be tested.

Test:

Create a Test-file file, content: I ' m test file, and then upload using the Fdfs_upload_file command, the results are as follows:

To write the test.php test interface:

<?php$file_info=fastdfs_get_file_info1 (' group1/m00/00/00/cgegflarnzmlrb8kaaaadvvpdfc8638629 '); Var_dump ($ File_info);? >

The test results are as follows:

Second, install apache2 extension:

Deploy Web server on each storage server, provide HTTP services directly to the outside world, do not need to deploy Web server on tracker server, if the request file does not exist on the current storage, the source storage is reversed by file ID, The direct request source Storage,fastdfs Extension module does not depend on the FASTDFS server, can exist independently!

Installing the apache2 on the storage

Apt-get Install apache2 Apache2.2-common apache2.2-bin apache2-utils apache2-mpm-prefork libapache2-mod-php5 Apache2-prefork-dev

Download Expansion Packs

wget http://fastdfs.googlecode.com/files/fastdfs-apache-module_v1.10.tar.gz

Since the configuration of the default package is under CentOS configuration, it is necessary to modify the makefile file before installing

The corresponding variable of the tar zxvf fastdfs-apache-module_v1.10.tar.gzcd FASTDFS-APACHE-MODULE/SRCVI makefile# is changed to the following value, Only for Apache2apache_base_path=/usr/share/apache2/apxs=/usr/bin/apxs2apachectl=/usr/bin/apachectl installed under apt mode in debian6

Installation

Makemake Install

Modifying the Apache2 Configuration

#创建mod_fastdfs. load file Vi/etc/apache2/mods-available/mod_fastdfs.loadloadmodule fastdfs_module/usr/lib/apache2/ modules/mod_fastdfs.so<location/m00>    SetHandler  fastdfs</location>
#加载mod_fastdfs. So module A2enmod Mod_fastdfs
#修改虚拟主机配置, modify the value of the associated variable and add the alias row configuration vi/etc/apache2/sites-enabled/000-defaultdocumentroot/var/www<directory/var/www >alias/group1/m00/var/www/data

Modifying the mod_fastdfs.conf configuration

Vi/etc/fdfs/mod_fastdfs.confbase_path=/var/wwwtracker_server=x.x.x.x:22122store_path0=/var/www

Configuration takes effect

/etc/init.d/apache2 restart

Test upload an image first:

fdfs_upload_file/etc/fdfs/client.conf 2.jpg

Return to File Id:group1/m00/00/00/cgegflarrqg5nsu_aacln3weca8908.jpg

Test the following in the browser:

Third, add nginx extension:

To download the expansion pack:

wget http://fastdfs-nginx-module.googlecode.com/files/fastdfs-nginx-module_v1.10.tar.gz

Because Nginx modules are static loading, it is necessary to compile and install Nginx, the process is as follows:

./configure  --prefix=/etc/nginx2/  --user=nginx--group=nginx--with-http_ssl_module--with-http_realip_ Module--with-http_addition_module               --with-http_sub_module--with-http_dav_module--with-http_flv_module-- With-http_mp4_module--with-http_gzip_static_module               --with-http_random_index_module--with-http_secure_link_ Module--with-http_stub_status_module--with-file-aio--with-ipv6       --add-module=/root/fastdfs-nginx-module/ Srcmake && make Install

To modify nginx.conf, add the following:

vi/etc/nginx2/conf/nginx.conf# Add the following under the server field location/m00 {       root/opt/fdfs/data;       Ngx_fastdfs_module;}

/etc/fdfs/mod_fastdfs.conf configuration files are modified and apache2 consistent, tested to work properly

Fastdfs http://www.cnblogs.com/lori/archive/2013/05/21/3090134.html

Fastdfs configuration:http://ylw6006.blog.51cto.com/470441/948729/

Fastdfs configuration File Description http://bbs.chinaunix.net/thread-1941456-1-1.html

Fastdfs concept:http://www.oschina.net/p/fastdfs/

Fastdfs installation:http://www.icultivator.com/p/4862.html

Fastdfs Daquan official website:http://bbs.chinaunix.net/forum-240-1.html

http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=4074700

http://blog.csdn.net/monkey_d_meng/article/details/6038995

Complete installation configuration:http://blog.csdn.net/monkey_d_meng/article/details/6038995

This comparison is all:http://elf8848.iteye.com/blog/1739596

Fastdfs installation:http://blog.163.com/023_dns/blog/static/1187273662012101711031704/

PHP below Fastdfs How to use: http://www.zrwm.com/?p=4567

Fastdfs Install extension--install PHP, Apache and nginx fastdfs extension "all Fastdfs documents"

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.