【fastDFS】Nginx+FastDFS module安装,fastdfsnginx


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

用浏览器访问返回的链接


 

相关内容

    暂无相关文章