Ubuntu+FastDFS+Nginx

一、安装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

修改配置文件

cdfastdfs-Nginx-module/src

vi config:

去掉里面所有的local


ulimit-SHn102400 useradd-s/sbin/nologinwwwcdNginx-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 makeinstall

报错: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

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...