【fastDFS】Nginx+FastDFS module安装

1:下载安装包

进入目录

cd/usr/local/

安装wget

yuminstall wget

下载fastdfs module:

wget https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip

下载nginx lua:

wget http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz

解压缩

unzipmaster.zip

tar -zxvf ngx_openresty-1.7.10.1.tar.gz

2:安装ngx_openresty

 

安装编译环境

 

yuminstall pcre-devel openssl openssl-devel

 

安装ngx_openresty,在ngx_openresty目录,执行

 

./configure--with-luajit --with-http_stub_status_module --with-http_ssl_module--with-http_realip_module --add-module=../fastdfs-nginx-module-master/src

gmake

gmake install

 

创建nginx使用的目录

 

mkdir -p/data/nginx

 

创建mod_fastdfs.conf文件

 

cp/usr/local/fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs/

3:配置ngx_openresty

建立目录

mkdir -p/data/nginx/logs

修改/etc/fdfs/mod_fastdfs.conf文件(未列出内容无需修改),修改的内容如下:

base_path=/data/nginx

tracker_server=192.168.22.208:22122

group_name=group1

store_path0=/data/fdfs

url_have_group_name = true

log_filename=/data/nginx/logs/mod_nginx.log

group_count = 1

[group1]

group_name=group1

storage_server_port=23000

store_path_count=1

store_path0=/data/fdfs

添加http.conf和mine.types文件

复制http.conf和mime.types到/etc/fdfs目录

cd/usr/local/fastdfs-master/conf

sudo cp http.conf mime.types /etc/fdfs/

 

配置nginx.conf文件

 

修改nginx的/usr/local/openresty/nginx/conf/nginx.conf

 

#usernobody;

user root;

worker_processes 1;

error_log /data/nginx/error.log;

events {

   worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local]"$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent""$http_x_forwarded_for"';

access_log /data/nginx/access.log main;

sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

listen 80;

server_name localhost;

charset utf8;

location /group1/M00 {

    alias /data/fdfs/data;

    ngx_fastdfs_module;

}

}

启动nginx命令:

 

/usr/local/openresty/nginx/sbin/nginx

 

重新载入nginx配置:

 

/usr/local/openresty/nginx/sbin/nginx-s reload

 

上传测试文件,命令为:

 

/usr/bin/fdfs_test/etc/fdfs/client.conf upload test.html

用浏览器访问返回的链接


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 16
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

杨倩-Yvonne

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值