###下载zlib
http://zlib.net/
1 2 3 4 5 6 7
| wget http://zlib.net/zlib-1.2.8.tar.gz tar -zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure make make install
|
###下载安装pcre
http://pcre.org/
1 2 3 4 5 6 7
| wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz tar -zxvf pcre-8.34.tar.gz cd pcre-8.34 ./configure make make install
|
###nginx安装
nginx编译安装需要添加fastdfs-nginx-module的模块,路径为fastdfs-nginx-module/src的路径.
1 2 3 4 5 6 7 8
| sudo ./configure --with-pcre=../pcre-8.36 \ --with-zlib=../zlib-1.2.8 \ --add-module=../fastdfs-nginx-module/src
make make install
|
###mod_fastdfs.conf 配置
mod_fastdfs.conf配置基本和storage的配置差不多,主要是一下几条记录的配置
1 2 3 4 5 6 7 8 9
| tracker_server=192.168.10.11:22122 #tracker服务器
storage_server_port=23000 #storage服务器端口
group_name=group1 #这台服务器的group名 store_path0=/home/vagrant/fastdfs_data/storage/ #store_path路径,和storage.conf相同
|
###nginx配置
首先在storage/data中建立软链
1 2
| ln -s //home/vagrant/fastdfs_data/storage/data /home/vagrant/fastdfs_data/storage/data/M00
|
然后在nginx中配置如下
1 2 3 4 5 6 7 8 9 10 11 12
| server { listen 8090; server_name 192.168.11.10; access_log logs/fastdfs.log; location /M00{ root /home/vagrant/fastdfs_data/storage/data; ngx_fastdfs_module; }
}
|
如果有多个store_path值,可以继续上面的步骤. 假设store_path有多个值,可以为这几个值创建不同的软链.在nginx继续添加location配置,例如
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| ln -s //home/vagrant/fastdfs_data/storage/data /home/vagrant/fastdfs_data/storage/data/M00
ln -s //home/vagrant/fastdfs_data/storage1/data /home/vagrant/fastdfs_data/storage1/data/M01
server { listen 8090; server_name 192.168.11.10; access_log logs/fastdfs.log; location /M00{ root /home/vagrant/fastdfs_data/storage/data; ngx_fastdfs_module; }
location /M01{ root /home/vagrant/fastdfs_data/storage1/data; ngx_fastdfs_module; }
}
|