温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Ubuntu+FastDFS+Nginx

发布时间:2020-08-02 17:05:29 来源:网络 阅读:1259 作者:冰心无影 栏目:建站服务器

一、安装libfastcommon

1、wget https://github.com/happyfish200/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/happyfish200/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

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI