一、安装libfastcommon
1、wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
2、tar -xvf V1.0.7.tar.gz
3、cd libfastcommon-1.0.7
4、./make.sh
5、./make.sh install
6、创建软链接:
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
二、安装FastDFS
1、wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
2、tar -zxvf V5.05.tar.gz -C /usr/local
3、cd /usr/local/fastdfs-5.05/
4、./make.sh
5、./make.sh install
6、cd /etc/fdfs
配置文件设置
cd /etc/fdfs
cp tracker.conf.sample tracker.conf
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf
修改配置文件
tracker.conf:
base_path=/data/fastdfs
storage.conf:
base_path=/data/fastdfs/storage
base_path0=/data/fastdfs/storage
tracker_server=xx:xx:xx:xx:22122
client.conf:
base_path=/data/fastdfs/client
tracker_server=xx:xx:xx:xx:22122
启动:
cd /usr/fastdfs-5.05/storage
cd /usr/fastdfs-5.05/trackerd
fdfs_trackerd /etc/fdfs/tracker.conf
fdfs_storaged /etc/fdfs/storage.conf
三、安装Nginx
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz/download
tar zxf fastdfs-nginx-module_v1.16.tar.gz && tar zxf nginx-1.8.0.tar.gz
修改配置文件
cd fastdfs-nginx-module/src
vi config:
去掉里面所有的local
ulimit -SHn 102400 useradd -s /sbin/nologin wwwcd nginx-1.8.0 /configure --user=www --group=www --add-module=../fastdfs-nginx-module/src/ --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module make make install
报错:error: the HTTP rewrite module requires the PCRE library
sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install openssl libssl-dev
nginx.conf:
listen 8888;
location /group1/M00/ {
alias /data/fastdfs/storage/data/;
}
启动Nginx:
cd /usr/local/nginx/sbin
./nginx
查看Nginx与DFS启动:
netstat -npl |grep -E "nginx|fdfs"
cd /usr/local/nginx/sbin/
修改配置重启Nginx:./nginx -s reload
加载配置文件启动:./nginx -c /usr/FastDFS/nginx-1.8.0/conf/nginx.conf
停止:nginx -s stop
查看端口号:
netstat -ntpl
三、卸载Nginx
sudo apt-get --purge remove nginx
sudo apt-get autoremove
测试上传:
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /usr/FastDFS/001.jpg
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /usr/FastDFS/001.jpg
nginx.conf正则表达式:
https://segmentfault.com/a/1190000002797601
转载于:https://blog.51cto.com/12854546/1929492