centos の次のチュートリアル コラムでは、centos7 fastdfs の展開について紹介します。
centos7 fastdfs の展開### start from here ## 前置准备依赖c++ : yum -y install libevent libevent-devel perl make gcc zlib zlib-devel pcre pcre-devel gcc-c++ openssl-devel
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.43.tar.gz mv V1.0.43.tar.gz libfastcommon-1.0.43.tar.gz && tar -xvf libfastcommon-1.0.43.tar.gz cd libfastcommon-1.0.43 && ./make.sh && ./make.sh install
wget https://github.com/happyfish100/fastdfs/archive/V6.06.tar.gz mv V6.06.tar.gz fdfs6.06.tar.gz && tar -xvf fdfs6.06.tar.gz cd cd fastdfs-6.06 && ./make.sh && ./make.sh install cp -r conf/* /etc/fdfs && rm -f *.sample . 在$base_path 下新建data 和logs目录(存储trackerd.log 和storaged.log) cd $base_path && mkdir -p data && mkdir logs
port=22122 # tracker服务器端口(默认22122,一般不修改) base_path=/etc/fdfs # 存储日志和数据的根目录
port=23000 # storage服务端口(默认23000,一般不修改) base_path=/etc/fdfs # 数据和日志文件存储根目录 store_path0=/etc/fdfs # 第一个存储目录 tracker_server=192.168.110.151:22122 # tracker也就是fdfs服务器IP和端口 http.server_port=8888 # http访问文件的端口(默认8888,看情况修改,和nginx中保持一致)
base_path=/etc/fdfs tracker_server=192.168.110.151:22122 #tracker服务器IP和端口
sh fastfdfs_services.sh
/etc/init.d/fdfs_trackerd start/stop/restart /etc/init.d/fdfs_storaged start/stop/restart
/usr/bin/fdfs_test /etc/fdfs/client.conf upload $filename
example file url: http://192.168.110.151/group1/M00/00/00/wKhul1-qhhKAO3ywAAABcxvxSxw5288_big.jpg
wget https://github.com/happyfish100/fastdfs-nginx-module/archive/V1.22.tar.gz cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
vim /etc/fdfs/mod_fastdfs.conf tracker_server=192.168.0.104:22122 #tracker服务器IP和端口 url_have_group_name=true store_path0=/home/dfs
wget http://nginx.org/download/nginx-1.15.4.tar.gz #下载nginx压缩包 tar -zxvf nginx-1.15.4.tar.gz cd nginx-1.15.4/ ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ # 添加fastdfs-nginx-module模块 make && make install
touch /usr/local/nginx/logs/nginx.pid && chmod a+w /usr/local/nginx/logs/nginx.pid vim /usr/local/nginx/conf/nginx.conf #添加如下配置 pid /usr/local/nginx/logs/nginx.pid; server { listen 8888; ## 该端口为storage.conf中的http.server_port相同 server_name 192.168.110.151; location ~/group[0-9]/ { ngx_fastdfs_module; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
./nginx -c /usr/local/nginx/conf/nginx.conf # 根据配置启动 /usr/local/nginx/sbin/nginx #启动nginx /usr/local/nginx/sbin/nginx -s reload #重启nginx /usr/local/nginx/sbin/nginx -s stop #停止nginx
nginx访问 访问:http://192.168.0.104:8888/group1/M00/00/00/wKgAaFyMoNKAUNcVAAWjVxW4v70993.jpg
以上がcentos7 fastdfs のデプロイメントについての詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。