FastDFS & Nginx install
来源:互联网 发布:gas mask mac 下载 编辑:程序博客网 时间:2024/06/05 07:54
FastDFS
Just demonstrate to how to use it.
You should dive into when using it for productive environment.
安装FastDFS (standalone)
环境以及软件准备
ip: 192.168.13.33
path: /tmp/fastdfs
# 下载FastDFS安装包及Nginx模块插件mkdir /tmp/fastdfscd /tmp/fastdfsgit clone https://github.com/happyfish100/libfastcommongit clone https://github.com/happyfish100/fastdfsgit clone https://github.com/happyfish100/fastdfs-nginx-modulewget "http://nginx.org/download/nginx-1.13.0.tar.gz"# 安装依赖包yum groupinstall -y "Development Tools"yum install -y libevent* pcre-devel zlib-devel openssl openssl-devel
FastDFS 安装
cd /tmp/fastdfs/libfastcommon./make.sh./make.sh installcd /tmp/fastdfs/fastdfs./make.sh./make.sh install# 配置 ip && paths.cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.confvim /etc/fdfs/tracker.confbind_addr=192.168.13.33base_path=/tmp/fastdfscp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.confvim /etc/fdfs/storage.confbase_path=/tmp/fastdfsstore_path0=/tmp/fastdfstracker_server=192.168.13.33:22122
Nginx 安装
cd /tmp/fastdfstar -xvf nginx-1.13.0.tar.gzcd nginx-1.13.0mkdir -vp /var/cache/nginx/{client_temp,proxy_temp,fastcgi_temp,uwsgi_temp,scgi_temp}# ./configure./configure --prefix=/etc/nginx \--sbin-path=/usr/sbin/nginx \--conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/var/run/nginx.pid \--lock-path=/var/run/nginx.lock \--http-client-body-temp-path=/var/cache/nginx/client_temp \--http-proxy-temp-path=/var/cache/nginx/proxy_temp \--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \--http-scgi-temp-path=/var/cache/nginx/scgi_temp \--user=nginx --group=nginx --with-http_ssl_module \--with-http_realip_module --with-http_addition_module \--with-http_sub_module --with-http_dav_module \--with-http_flv_module --with-http_mp4_module \--with-http_gunzip_module --with-http_gzip_static_module \--with-http_random_index_module --with-http_secure_link_module \--with-http_stub_status_module --with-mail --with-mail_ssl_module \--with-file-aio --with-ipv6 \--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 \-fexceptions -fstack-protector --param=ssp-buffer-size=4 \-m64 -mtune=generic' \--add-module=/tmp/fastdfs/fastdfs-nginx-module/srcmake && make install# 配置 nginx.confvim /etc/nginx/nginx.conf# nginx访问fds的权限问题user root;server { listen 80; server_name 192.168.13.33; location / { root html; index index.html index.htm; } location /group1/M00/ { alias /tmp/fastdfs/data; ngx_fastdfs_module; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }}# 添加nginx用户useradd -M -s /sbin/nologin nginx# 配置 cp /tmp/fastdfs/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfscp /tmp/fastdfs/fastdfs/conf/http.conf /etc/fdfs/cp /tmp/fastdfs/fastdfs/conf/mime.types /etc/fdfs/vim /etc/fdfs/mod_fastdfs.confbase_path=/tmp/fastdfstracker_server=192.168.13.33:22122store_path0=/tmp/fastdfsurl_have_group_name=true
启动
# 启动 tracker/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf# 启动 storage/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf# 执行检查netstat -ltnp | grep fdfs
# 启动 Nginx/usr/sbin/nginx -c /etc/nginx/nginx.conf
测试
vim /etc/fdfs/client.confbase_path=/tmp/fastdfstracker_server=192.168.13.33:22122http.tracker_server_port=80cd /tmpvim hello-fdfs.txt# 写入 hello fastdfs. hello nginx.# 上传文件/usr/local/bin/fdfs_test /etc/fdfs/storage.conf upload hello-fdfs.txt # 上传输出如下图:
# 在浏览器中使用 http://192.168.13.33/group1/M00/00/00/wKgNIVkdSxSAVIDAAAAAHM2M_Qg494_big.txt 进行访问结果如下图:
至此,FastFDS (standalone)安装部署完毕
集群安装 (cluster)
以 192.168.13.32, 192.168.13.33 两台机器为集群机器
每台机器都需要按照上述的步骤进行安装
安装好单机版,并运行通过之后,停掉每台FastDFS上的相关进程,进行如下配置,两台机器配置一致
配置
vim /etc/fdfs/tracker.confuse_storage_id = truecp /tmp/fastdfs/fastdfs/conf/storage_ids.conf /etc/fdfs/vim /etc/fdfs/storage_ids.conf100001 group1 192.168.13.32100002 group1 192.168.13.33vim /etc/fdfs/storage.conftracker_server=192.168.13.32:22122tracker_server=192.168.13.33:22122vim /etc/fdfs/mod_fastdfs.conftracker_server=192.168.13.32:22122tracker_server=192.168.13.33:22122 vim /etc/fdfs/client.conftracker_server=192.168.13.32:22122tracker_server=192.168.13.33:22122# 启动 /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf/usr/sbin/nginx -c /etc/nginx/nginx.conf# 测试这里就不赘述了
阅读全文
0 0
- FastDFS & Nginx install
- FASTDFS-install
- Nginx + FastDFS
- fastdfs nginx
- Nginx+FastDFS
- fastDFS+nginx
- Fastdfs+nginx
- fastdfs+nginx+fastdfs-nginx-module
- FastDfs (二) Nginx 整合 Fastdfs
- 【fastDFS】Nginx+FastDFS module安装
- FastDFS+nginx+fastdfs-nginx-module服务器配置
- FastDFS+nginx+fastdfs-nginx-module服务器配置
- centos安装FastDFS+Nginx
- fastdfs+nginx安装详解
- nginx下配置FastDFS
- FastDFS之nginx插件
- FastDfs+nginx环境配置
- FastDfs+nginx环境配置
- 多重继承引发的二义性问题及解决方法分析
- Git使用
- 硬编码与软编码
- 《数据结构学习与实验指导》2-6:数列求和
- 如何将从数据库中读出的带有html标签的字符串,让标签起效,显示在前台页面
- FastDFS & Nginx install
- Maven的下载 安装 环境配置
- LINUX下实现sleep
- Multi-Programming-9 非线程安全类实现生产者和消费者
- #pragma warning 指令集
- Git使用详细教程
- ubuntu误删文件造成软件包信息列表损坏无法更新或安装文件
- 关于typeAliases标签理解 自己挖的坑啊,解决了好久的问题。
- 半夜三更搞不同长度字符对齐问题,头痛