linux7安装fastdfs,CentOS7安装fastdfs

CentOS7安装fastdfs

安装CentOS基本依赖:

yum -y install tcl lrzsz deltarpm zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip net-tools wget

所需安装包:

fastdfs-5.11.tar.gz

fastdfs-nginx-module-1.20.tar.gz

libfastcommon-1.0.39.tar.gz

nginx-1.15.8.tar.gz

1.安装common

1.解压:tar -zxvf libfastcommon-1.0.39.tar.gz

2.编译和安装:cd libfastcommon-1.0.39 && ./make.sh && ./make.sh install

3.查看安装好以后的common文件:cd /usr/lib && ll libfast*

2.安装tracker服务

1.解压:tar -zxvf fastdfs-5.11.tar.gz

注:把一些会用到的库先拷贝到/etc/fdfs下

cp /development/fastdfs-5.11/conf/mime.types /etc/fdfs/

cp /development/fastdfs-5.11/conf/http.conf /etc/fdfs/

2.编译和安装:cd fastdfs-5.11 && ./make.sh && ./make.sh install

3.查看安装好以后的dfs文件:

cd /usr/bin && ll fdfs*

cd /etc/fdfs && ll fdfs*

4.把解压出的fastdfs-5.11中的conf目录

5.配置tracker.conf

vim /development/fastdfs-5.11/conf/tracker.conf

修改base_path

base_path=/development/fastdfs/tracker

6.新建相关目录

mkdir /development/fastdfs/tracker -p

mkdir /development/fastdfs/client -p

mkdir /development/fastdfs/storage -p

mkdir /development/fastdfs/tmp -p

mkdir /var/temp/nginx/client -p

7.启动服务

(fdfs_trackerd已经在/usr/bin目录下)

fdfs_trackerd /development/fastdfs-5.11/conf/tracker.conf

fdfs_trackerd /development/fastdfs-5.11/conf/tracker.conf stop

fdfs_trackerd /development/fastdfs-5.11/conf/tracker.conf restart

3.安装storage服务

vim /development/fastdfs-5.11/conf/storage.conf

1.配置storage.conf

修改base_path,group_name,store_path0,tracker_server,bind_addr

group_name=source

base_path=/development/fastdfs/storage

store_path0=/development/fastdfs/storage

tracker_server=当前ip

2.启动服务

fdfs_storaged /development/fastdfs-5.11/conf/storage.conf

4.配置client测试上传

1.配置client.conf

vim /development/fastdfs-5.11/conf/client.conf

修改base_path,tracker_server

tracker_server=当前ip

base_path=/development/fastdfs/client

2.测试上传(不支持直接上传远端图片测试)

fdfs_test /development/fastdfs-5.11/conf/client.conf upload /development/test.jpg

注:如果测试上传不成功并且配置没问题,可以试着重启虚拟机再试

5.将nginx和fastdfs结合起来

1.解压:tar -xzvf fastdfs-nginx-module-1.20.tar.gz

2.修改配置文件:

vim /development/fastdfs-nginx-module-1.20/src/config

ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon"

CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon"

3.安装nginx

解压 tar -zxvf /development/nginx-1.15.8.tar.gz

1.配置nginx

cd /development/nginx-1.15.8

./configure \

--prefix=/usr/local/nginx \

--pid-path=/var/run/nginx/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--error-log-path=/usr/local/nginx/errors/error.log \

--http-log-path=/usr/local/nginx/logs/access.log \

--with-http_gzip_static_module \

--http-client-body-temp-path=/var/temp/nginx/client \

--http-proxy-temp-path=/var/temp/nginx/proxy \

--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \

--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \

--http-scgi-temp-path=/var/temp/nginx/scgi \

--add-module=/development/fastdfs-nginx-module-1.20/src

2.编译安装

make && make install

nginx目录:/usr/local/nginx

3.配置fastdfs-nginx-module

vim /development/fastdfs-nginx-module-1.20/src/mod_fastdfs.conf

mv /development/mod_fastdfs.conf/fastdfs-nginx-module-1.20/src/ /etc/fdfs

修改base_path,tracker_server,group_name,url_have_group_name,store_path0

base_path=/development/fastdfs

store_path0=/development/fastdfs/storage

tracker_server=当前ip:22122

group_name=source

url_have_group_name=true

4.修改nginx主配置文件

mkdir /usr/local/nginx/conf/conf.d

vim /usr/local/nginx/conf/nginx.conf

#user nobody;

worker_processes 1;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

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 logs/access.log main;

sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

listen 80;

server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {

root /home/www;

index index.html index.htm;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /home/www;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

#location ~ \.php$ {

# root html;

# fastcgi_pass 127.0.0.1:9000;

# fastcgi_index index.php;

# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

# include fastcgi_params;

#}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

# deny all;

#}

}

include conf.d/*.conf;

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

# listen 8000;

# listen somename:8080;

# server_name somename alias another.alias;

# location / {

# root html;

# index index.html index.htm;

# }

#}

# HTTPS server

#

#server {

# listen 443 ssl;

# server_name localhost;

# ssl_certificate cert.pem;

# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;

# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;

# ssl_prefer_server_ciphers on;

# location / {

# root html;

# index index.html index.htm;

# }

#}

}

5.增加fastdfs和nginx的配置文件

vim /usr/local/nginx/conf/conf.d/fastdfs-server.conf

server {

listen 9870;

server_name 192.168.160.182;

location /source/M00 {

ngx_fastdfs_module;

}

}

注:不要忘记把此端口加入防火墙中

6.启动nginx

检测脚本是否配置正确 /usr/local/nginx/sbin/nginx -t

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值