FastDFS--扩展篇(Php&&Apache2&&Nginx)
???
? ? FastDFS不是通用的文件系统,只能通过专用的API来访问,目前提供了C JAVA PHP的API,下面我们来安装php扩展。
? ??让Fastdfs支持php,在FastDFS的源码包解压后里面有个php_client目录,进入此目录,参照README进行安装:
?
? ? 编写test.php测试界面:
?
?
? ? 安装apache2扩展:
? ??在每台storage server上部署web server,直接对外提供HTTP服务,tracker server上不需要部署web server,如果请求文件在当前storage上不存在,通过文件ID反解出源storage,直接请求源storage,FastDFS扩展模块不依赖于FastDFS server,可以独立存在!
? ? 在storage上安装apache2
?
?
?
?
?
?
?
?
?
?
? ? 添加nginx扩展:
? ? 下载扩展包:
?
view source?print?1
wget http://fastdfs-nginx-module.googlecode.com/files/fastdfs-nginx-module_v1.10.
tar
.gz
?
? ? 由于nginx的模块都为静态加载,所以需要编译安装nginx,过程如下:
?
view source?print?1
./configure? --prefix=/etc/nginx2/? --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module
2
??????????????
--with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module
3
??????????????
--with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-
file
-aio --with-ipv6
4
??????????
--add-module=/root/fastdfs-nginx-module/src
5
?6
make
&&
make
install
?
? ? 修改nginx.conf,添加如下内容:
?
view source?print?1
vi
/etc/nginx2/conf/nginx.conf
2
#在server字段下添加以下内容
3
location /M00 {
4
???????
root /opt/fdfs/data;
5
???????
ngx_fastdfs_module;
6
}
?
? ?? /etc/fdfs/mod_fastdfs.conf配置文件的修改和apache2一致,经过测试可以正常工作