文件服務器
0.提前建好需要的文件夾(/home/fastdfs)
/home/fastdfs/tracker
/home/fastdfs/storage
/home/fastdfs/storage/path0
/home/fastdfs/
/home/fastdfs/mod
1.圖片服務器搭建,上傳所需要的jar包並解壓到指定目錄(/usr/local/)
2.安裝gcc
yum -y install gcc-c++
3.安裝libevent工具包(解壓,進入解壓文件/usr/local/)
cd /usr/local/libfastcommon-1.0.7
./make.sh
./make.sh install
cp /usr/lib64/libfastcommon.so /usr/lib
4.tracker server 安裝(/usr/local/FastDFS)
cd FastDFS
./make.sh
./make.sh install
cd /usr/local/FastDFS/conf
cp * /etc/fdfs
cd /etc/fdfs
vim tracker.conf
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart 啟動tracker
5.storage server安裝
cd /etc/fdfs
vim storage.conf
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart 啟動storage
6. 測試上傳文件
cd /etc/fdfs
vim client.conf
/usr/bin/fdfs_test /etc/fdfs/client.conf /etc/fdfs/anti-steal.jpg
7.配置fastdfs-nginx-module
解壓fastdfs-nginx-module_v1.16.tar.gz到/usr/local
cd /usr/local/fastdfs-nginx-module/src
vim config (去掉所有local)
vim mod_fastdfs.conf
8.fastdfs+nginx
cd /usr/local/nginx-1.11.6
復制下邊這段,自動執行
./configure \ --prefix=/usr/local/nginx \ --add-module=/usr/local/fastdfs-nginx-module/src
make
make install
vim /usr/local/nginx/conf/nginx.conf
server { listen 80; server_name localhost; location /group1/M00/{ ngx_fastdfs_module; } }
9.啟動nginx,上傳圖片並訪問
將nginx和tracker、storage配置為開機自啟動
vim /etc/rc.local
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /etc/fdfs/anti-steal.jpg