说明:centos7单机部署 nginx fastdfs

## 创建一下目录作为存储数据图片的路径 可以自己定义

mkdir -pv /data/application/{storage,tracker,client}

cd /data/application/

yum install lrzsz wget git gcc gcc-c++ zlib-devel cmake make

git clone git@github.com:happyfish100/libfastcommon.git

git clone git@github.com:happyfish100/fastdfs.git

git clone git@github.com:happyfish100/fastdfs-nginx-module.git

wget http://nginx.org/download/nginx-1.9.4.tar.gz

tar xf nginx-1.9.4.tar.gz -c /usr/local

cd /usr/local/nginx-1.9.4

### 编译nginx 检查编译过程 出现缺少的包 及时进行安装 保证编译的顺利进行

./configure --prefix=/usr/local/nginx --add-module=/data/application/fastdfs-nginx-module && make && make install

cd ..;rm -rf nginx-1.9.4

cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf;cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf

### 说明:下面2行替换 是对之前创建的目录 进行保存数据使用 -->可以按照自己的需求进行自定义

sed -i 's@^base_path.*@base_path=/data/application/tracker@g' /etc/fdfs/tracker.conf

sed -i 's@store_path0=.*@store_path0=/data/application/storage@g' /etc/fdfs/storage.conf

### 说明:执行下面的时候 需要把ip地址改成自己的主机地址 才不会出错

sed -i 's$^tracker_server=.*$tracker_server=172.17.0.2:22122$g' storage.conf

### 启动 tracker server 后期重启直接后面跟 restart 就可以

### 启动之后记得查看 22122 端口

`which fdfs_trackerd` /etc/fdfs/tracker.conf

### 启动 storage server 后期重启直接后面跟 restart 就可以

`which fdfs_storaged` /etc/fdfs/storage.conf

### 启动之后记得查看 23000 端口

################# nginx start

/usr/local/nginx/sbin/nginx -t;/usr/local/nginx/sbin/nginx

### check nginx process 发现没有 woker 进程  只有master

ps -elf | grep nginx

### 查看 nginx 错误日志

#### 发现下面的错误

[2018-10-12 07:11:48] ERROR - file: shared_func.c, line: 1067, file /etc/fdfs/mod_fastdfs.conf not exist
[2018-10-12 07:11:48] ERROR - file: /data/application/fastdfs-nginx-module/src/common.c, line: 163, load conf file "/etc/fdfs/mod_fastdfs.conf" fail, ret code: 2
2018/10/12 07:11:48 [alert] 4447#0: worker process 4448 exited with fatal code 2 and cannot be respawned

### 解决方法 找到这个文件 复制到 /etc/fdfs/ 目录下

cp `find / -name mod_fastdfs.conf` /etc/fdfs/

### 重载 nginx 查看错误

/usr/local/nginx/sbin/nginx -s reload

#### 发现以下错误

[2018-10-12 08:39:59] ERROR - file: ini_file_reader.c, line: 1029, include file "http.conf" not exists, line: "#include http.conf"
[2018-10-12 08:39:59] ERROR - file: /data/application/fastdfs-nginx-module/src/common.c, line: 163, load conf file "/etc/fdfs/mod_fastdfs.conf" fail, ret code: 2
2018/10/12 08:39:59 [alert] 4447#0: worker process 4600 exited with fatal code 2 and cannot be respawned

### 解决方法 找到这个错误提示的文件 http.conf 复制到 /etc/fdfs/ 目录下

cp `find / -name http.conf` /etc/fdfs/

### 重启nginx 继续查看错误日志

/usr/local/nginx/sbin/nginx -s reload

#### 发现以下的错误

2018/10/12 08:44:48 [notice] 4609#0: signal process started
ngx_http_fastdfs_process_init pid=4610
[2018-10-12 08:44:48] ERROR - file: shared_func.c, line: 1067, file /etc/fdfs/mime.types not exist
2018/10/12 08:44:48 [alert] 4447#0: worker process 4610 exited with fatal code 2 and cannot be respawned

### 直接在/data目录查找这个文件  复制到 /etc/fdfs/目录下

cp `find /data -name mime.types` /etc/fdfs/

### 修改/etc/fdfs/mod_fastdfs.conf配置文件配合nginx

sed -i 's@^tracker_server=.*@tracker_server=172.17.0.2:22122@g' /etc/fdfs/mod_fastdfs.conf

sed -i 's@^url_have_group_name.*@url_have_group_name = true@' /etc/fdfs/mod_fastdfs.conf

sed -i 's@^store_path0=.*@store_path0=/data/application/storege@g' /etc/fdfs/mod_fastdfs.conf

sed -i '$a\#include http.conf' /etc/fdfs/mod_fastdfs.conf

### 这一步看自己爱好执行  删除多余行

sed -i '/^ *#/d' /usr/local/nginx/conf/nginx.conf

/usr/local/nginx/sbin/nginx -s reload

#### 这会儿发现错误日志 没有报错了 worker 进程也启动了

### 进行上传图片测试 修改/etc/fdfs/client.conf文件    ip替换成自己的主机地址

sed -i 's@base_path=.*@base_path=/data/application/client@g' /etc/fdfs/client.conf

sed -i 's@tracker_server=.*@tracker_server=172.17.0.2:22122@g' /etc/fdfs/client.conf

最近太忙:一台部署可以参考这个地址做 https://github.com/judasn/Linux-Tutorial/blob/master/markdown-file/FastDFS-Nginx-Lua-GraphicsMagick.md

  notice:  echo "include http.conf'" >>/etc/fdfs/mod_fastdfs.conf

https://github.com/judasn/Linux-Tutorial/blob/master/markdown-file/FastDFS-Nginx-Lua-GraphicsMagick.md

centos7 install nginx+fastdfs的更多相关文章

  1. Centos7 上安装FastDFS

    Centos7 上安装 FastDFS 本文章摘抄于 风止鱼歇  博客地址:https://www.cnblogs.com/yufeng218/p/8111961.html 1.安装gcc(编译时需要 ...

  2. CentOS7安装Nginx并部署

    服务器IP是192.168.36.136 1.直接yum install nginx即可 2.主配置文件是/etc/nginx/下的nginx.conf,另外一个是/etc/nginx/conf.d/ ...

  3. centos7 服务器安装nginx,mysql,php

    一.概述 项目的需要,今天在虚拟机上基于Centos安装配置了服务器运行环境,web服务用 nginx,数据库存储在mysql,动态脚本语言是php. 二.步骤 首页保证Centos7已经安装完毕,正 ...

  4. ASP.NET Core部署到CentOS7,使用Nginx代理

    ASP.NET Core 的运行环境由新开发的 Kestrel Server 负责,IIS 退回到 HTTP 的侦听器的角色,微软也特别为了这个需求开发了 IIS Platform Handler,以 ...

  5. CentOS7 安装Nginx+MySQL

    首先我们需要安装nginx的yum源 [root@AD ~]# rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-releas ...

  6. 部署文档(centos7.x\nginx\mysql5.6\jdk1.8\ssl\jboot)

    部署文档(centos7.x\nginx\mysql5.6\jdk1.8\ssl\jboot) 1.基础环境********************************************** ...

  7. CentOS7部署Nginx

    CentOS7部署Nginx 1.准备工作 Nginx的安装依赖于以下三个包,意思就是在安装Nginx之前首先必须安装一下的三个包,注意安装顺序如下: 1 SSL功能需要openssl库,直接通过yu ...

  8. Centos7 下nginx nginx-1.13.4 安装

    环境:CentOS Linux release 7.3.1611 (Core)  Linux localhost.localdomain 3.10.0-514.26.2.el7.x86_64 #1 S ...

  9. linux(centos7) 安装nginx

    linux(centos7) 安装nginx 1.14(stable) 版本 Nginx配置文件常见结构的从外到内依次是「http」「server」「location」等等,缺省的继承关系是从外到内, ...

随机推荐

  1. js---设置cookie的方法

    在客户端进行一些操作的时候,很多时候会要用到设置cookie的方法.具体的做法: <script type="text/javascript"> var documen ...

  2. Spark连接MongoDB之Scala

    MongoDB Connector for Spark Spark Connector Scala Guide spark-shell --jars "mongo-spark-connect ...

  3. Web 测试总结

    一.输入框 1.字符型输入框: (1)字符型输入框:英文全角.英文半角.数字.空或者空格.特殊字符“~!@#¥%……&*?[]{}”特别要注意单引号和&符号.禁止直接输入特殊字符时,使 ...

  4. 23.react-router 路由

    箭头函数扩展: 箭头函数: functoin 函数名(参数){    函数体 } 箭头函数: 1.把function删掉 , 2.参数和{}之间加上 箭头=> 简写: 1.参数的简写:只有一个参 ...

  5. Oracle 修改表 Alter Table...

    --增加列ALTER TABLE Student add sex number(2);--删除列ALTER TABLE Student drop column sex;--更改列属性 ALTER TA ...

  6. 渗透常用dos命令,http协议及数据提交方式。 hack 某某

    dir查看目录 cd 切换目录 strat www.xxx.com   打开网页 del 删除文件 cls 清屏幕命令 ipconfig  查看ip地址 netstat -an   显示网络连接.路由 ...

  7. day15,内置函数一

    1,复习,如何从生成器里面取值,next(每次取一个值),send(不可以用在第一个,取下一个的时候,给上一个地方传一个值),for(没有break会一直取,直到取完),强制转换(会一次性把数据加载到 ...

  8. 前端的重要部分js

    js用来实现页面的动态效果. js的特点:1.是客户端语言,客户端进行解释执行. 2.是一种脚本语言 3.是一种基于对象的语言,不用定义类和实例化对象,直接使用类即可 4.js前端和后端都可以做 js ...

  9. Memcache&Redis

    Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.减少数据库读取次数来提高网站速度 先在一台机器安装memcache 然后使用Python 安装pip3 i ...

  10. Python加密保护解决方案

    防止代码反编译,高强度加密保护exe或pyc文件 产品简介 Python语言写的程序无需编译成二进制文件代码,可以直接从源代码运行程序.在计算机内部,Python解释器把源代码转换成字节码的中间形式, ...