新聞中心
建站服務(wù)器
Fastdfs+Nginx配置操作
單臺配置
安裝包下載:
wget https://github.com/happyfish200/libfastcommon/archive/V1.0.7.tar.gz
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
wget https://github.com/happyfish200/fastdfs/archive/V5.05.tar.gz
wget http://nginx.org/download/nginx-1.8.0.tar.gz
(備注:centos7里面Nginx的依賴包是最新的可以yum直接下載安裝:yum install zlib* pcre* -y)
1.libfastcommon安裝;
mkdir -pv /usr/fastdfs
tar -zxvf V1.0.7.tar.gz -C /usr/fastdfs/
cd /usr/fastdfs/libfastcommon-1.0.7
./make.sh
./make.sh install
2.安裝Fastdfs;
tar -zxvf V5.05.tar.gz -C /usr/fastdfs/
cd /usr/fastdfs/fastdfs-5.05
(備注:在這個目錄下解壓的文件下面不用做鏈接)
./make.sh
./make.sh install
3.配置tracker和storage
cp conf/* /etc/fdfs/
(備注:FastDFS啟動文件默認(rèn)在/usr/bin/,配置文件在/etc/fdfs下)
mkdir -pv /data/fastdfs/tracker
mkdir -pv /data/fastdfs/storage
(備注:以上創(chuàng)建的是存放目錄)
cd /etc/fdfs
vim tracker.conf
暫時修改下面一項即可
base_path=/data/fastdfs/tracker
vim storage.conf
修改內(nèi)容:
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
tracker_server=本地IP地址:22122
http.server_port=8888
4.關(guān)閉防火墻,啟動tracker和storage
systemctl stop firewalld.service
/usr/bin/fdfs_tracker /etc/fdfs/tracker start
/usr/bin/fdfs_storage /etc/fdfs/storage start
5.驗證是否啟動
ps -ef | grep fdfs
6.安裝fastdfs-nginx-module
tar -zxvf fastdfs-nginx-module_v1.16.tar.gz -C /usr/local/
cd /usr/local/fastdfs-nginx-module/src
vim config
去掉local目錄層
CORE_INCS=$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/
cp mod_fastdfs.conf /etc/fdfs
vim /etc/fdfs/mod_fastdfs.conf
修改以下內(nèi)容;
connect_timeout=10
tracker_server=本地IP地址:22122
url_have_group_name = true
store_path0=/data/fastdfs/storage
7.裝Nginx
cd
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0/
./configure --prefix=/usr/local/nginx --add-module=/usr/local/fastdfs-nginx-module/src/
make
make install
vim /usr/local/nginx/conf/nginx.conf
在server 里面添加以下內(nèi)容
location ~/group1/M00{
root /data/fastdfs/storage/data;
ngx_fastdfs_module;
}
做個軟連接ln -s /data/fastdfs/storage/data //data/fastdfs/storage/data/M00
監(jiān)聽端口:
listen 8888
(備注:nginx里的端口要和配置FastDFS存儲中的storage.conf文件配置一致)
最后啟動Nginx上傳驗證
兩臺服務(wù)器可以把tracker和storage分開 nginx和storage一臺或者都安裝分成兩個組group
名稱欄目:Centos7單臺服務(wù)器搭建FastDFS+Nginx
文章出自:http://fisionsoft.com.cn/article/cjcsho.html