Linux下安装Nginx和FastDFS+Nginx 集成
    什么是nginx 这个谷歌一下 一大堆
本文主要介绍 如何在linux下安装nginx 和 FastDFS+Nginx 集成
Nginx的安装模块依赖性Nginx需要依赖下面的包
1. gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ )
2. rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )
3. fastdfs和nginx集成 需要 fastdfs-nginx-module_v1.15.tar 下载fastdfs的地方就有的下载
Nginx包下载: http://nginx.org/en/download.html
依赖包安装顺序依次为:
zlib、pcre, 然后安装Nginx包.
下面为我下载的包的版本

1.安装zlib-1.2.7.tar.gz[root@bogon usr]# tar -zxvf zlib-1.2.7.tar.gz
[root@bogon usr]# cd zlib-1.2.7
[root@bogon zlib-1.2.7]# ./configure 
[root@bogon zlib-1.2.7]# make
[root@bogon zlib-1.2.7]# make install
2.安装pcre-8.21.tar.gz[root@bogon usr]# tar -zxvf pcre-8.21.tar.gz
[root@bogon usr]# cd pcre-8.21
[root@bogon pcre-8.21]# ./configure 
[root@bogon pcre-8.21]# make
[root@bogon pcre-8.21]# make install
注意 这里的操作比较关键3.1 安装fastdfs-nginx模块
首先要下载 fastdfs-nginx-module_v1.15.tar.gz 
下载地址 https://code.google.com/p/fastdfs/downloads/detail?name=fastdfs-nginx-module_v1.15.tar.gz
拷贝到/usr目录下
执行 
tar vxzf fastdfs-nginx-module_v1.15.tar.gz
 4.安装 nginx-1.5.8.tar.gz[root@bogon usr]# tar -zxvf nginx-1.2.6.tar.gz 
[root@bogon usr]# cd nginx-1.2.6
[root@bogon nginx-1.2.6]# ./configure --with-pcre=../pcre-8.21 --with-zlib=../zlib-1.2.7 --add-module=../fastdfs-nginx-module/src
#这里是指定nginx安装所需要的依赖包的路径
[root@bogon nginx-1.2.6]# make
[root@bogon nginx-1.2.6]# make install
4.1配置nginx配置文件在nginx的server配置段中增加M00的location声明:
vi /usr/local/nginx/conf/nginx.conf
location /group1/M00 {  
            root /fastdfs_storage; 这个地方配置的fastdfs的存储路径
            ngx_fastdfs_module;  
    }  
# :wq  4.2配置mod_fastdfs.conf这时候需要将 fastdfs-nginx-module 的 mod_fastdfs.conf 拷贝一份到 /etc/fdfs 目录下
cp /usr/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/  
vi /etc/fdfs/mod_fastdfs.conf 
   # the base path to store log files  
# 放置log的目录  
base_path=/fastdfs_storage  
# FastDFS tracker_server can ocur more than once, and tracker_server format is  
# "host:port", host can be hostname or ip address  
# tracker1的ip和端口,此处可以写多个tracker server,每行一个  
tracker_server=192.168.56.101:22122  
#tracker_server=10.10.208.76:22122    
# the group name of storage server  
# 此台storage server所属的服务器组名  
group_name=group1     
# if uri including group name  
# default value is false  
# 在URL中包含group名称  
url_have_group_name = true    
# store_path#, based 0, if store_path0 not exists, it's value is base_path  
# the paths must be exist  
# 放置文件的目录  
store_path0=/fastdfs_storage
#:wq  
接下来我们要启动nginx
执行
/usr/local/nginx/sbin/nginx 
如果报端口已被占用
执行
netstat -anp|grep