标签:location jpg 获取 查看 val 解压 pcre processor tco
FastDFS(Fast Distributed File System)是一款开源轻量级分布式文件系统,我花费了一天的时间安装和配置通,期间参考:https://www.cnblogs.com/handsomeye/p/9451568.html,现在总结一下,希望能让后来者少走弯路。
环境:CentOS Linux release 7.3.1611 (Core)[cat /etc/redhat-release]
安装wget:yum install wget
安装lrzsz:yum install lrzsz
安装gcc:yum install gcc
安装:yum install vim
安装:yum groupinstall Development Tools
获取libfastcommon安装包:wget https://github.com/happyfish100/libfastcommon/archive/V1.0.38.tar.gz
解压安装包:tar -zxvf V1.0.38.tar.gz
进入目录:cd libfastcommon-1.0.38
执行编译:./make.sh
安装:./make.sh install
获取fdfs安装包:wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz
解压安装包:tar -zxvf V5.11.tar.gz
进入目录:cd fastdfs-5.11
执行编译:./make.sh
安装:./make.sh install
1. 进入/etc/fdfs目录,有三个.sample后缀的文件(自动生成的fdfs模板配置文件),通过cp命令拷贝tracker.conf.sample,删除.sample后缀作为正式文件。
2.编辑tracker.conf:vi tracker.conf,修改相关参数
base_path=/home/mm/fastdfs/tracker #tracker存储data和log的跟路径,必须提前创建好
http.server_port=80 #http端口,需要和nginx相同
3.启动tracker(支持start|stop|restart):/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
编辑storage.conf:vi storage.conf,修改相关参数:
base_path=/home/fastdfs/storage #storage存储data和log的跟路径,必须提前创建好
store_path0=/home/fastdfs/storage #如果为空,则使用base_path
tracker_server=192.168.1.103:22122 #配置该storage监听的tracker的ip和port
启动storage(支持start|stop|restart):
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
下载Nginx安装包 wget http://nginx.org/download/nginx-1.15.2.tar.gz
下载fastdfs-nginx-module安装包 wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.20.tar.gz
解压nginx:tar -zxvf nginx-1.15.2.tar.gz
解压fastdfs-nginx-module:tar -xvf V1.20.tar.gz
安装依赖的库 :yum install libpcre3 libpcre3-dev openssl libssl-dev libperl-dev
修改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/"
进入nginx目录:cd nginx-1.15.2,配置加载fastdfs-nginx-module模块:
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/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=/root/fastdfs-nginx-module-1.20/src
编译安装:make -> make install
启动、停止:
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop #此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程
./nginx -s quit #此方式停止步骤是待nginx进程处理任务完毕进行停止
./nginx -s reload
配置mod-fastdfs.conf,并拷贝到/etc/fdfs文件目录下
cd fastdfs-nginx-module-1.20/src/
cp mod_fastdfs.conf /etc/fdfs
进入/etc/fdfs修改mod-fastdfs.conf:
base_path=/home/fastdfs/storage
tracker_server=192.168.1.103:22122 #tracker的地址
url_have_group_name=true #url是否包含group名称
store_path0=/home/fastdfs/storage #文件存储的位置
配置nginx,新增server:
cd /usr/local/nginx/conf/
vim nginx.conf
server {
listen 80;
server_name 192.168.1.103;
location /group1/M00/ {
ngx_fastdfs_module;
}}
cd /usr/local/src/fastdfs-5.11/conf
cp mime.types http.conf /etc/fdfs/
测试服务:/usr/bin/fdfs_test /etc/fdfs/client.conf upload (指定配置文件)
example file url: http://192.168.1.107/group1/M00/00/00/wKgBa11_Lb2ADL_8AABdrSqbHGQ330_big.jpg
标签:location jpg 获取 查看 val 解压 pcre processor tco
原文地址:https://www.cnblogs.com/gangzi4321/p/11537409.html