yum -y groupinstall 'Development Tools'
yum -y install wget
vim /etc/init.d/fdfs_storaged 我们发现服务启动时是从/usr/local/bin/下去找*sh,所以我们需要将fast的启动和重启命令的脚本文件复制到相应目录
[root@localhost FastDFS]# cp /opt/FastDFS/restart.sh /usr/local/bin/
[root@localhost FastDFS]# cp /opt/FastDFS/stop.sh /usr/local/bin/
将启动脚本加入linux服务
[root@localhost FastDFS]# chkconfig --add /etc/init.d/fdfs_storaged
[root@localhost FastDFS]# chkconfig --add /etc/init.d/fdfs_trackerd
更改解压目录里面的storage.conf和trackver.conf的 base_path="/opt/fdfs"
[root@localhost conf]# vim storage.conf
[root@localhost conf]# vim tracker.conf
[root@localhost conf]# pwd
/opt/FastDFS/conf
find / -name fdfs_trackerd 发现我的文件是在/usr/bin/fdfs_trackerd,于是换个地方
cp /usr/bin/fdfs_trackerd /usr/local/bin/fdfs_trackerd
cp /usr/bin/fdfs_storaged /usr/local/bin/fdfs_storaged
再次运行 service fdfs_trackerd start
service fdfs_storaged start
测试一下
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/lmj/tangyan.jpg
报错了:
[2019-08-30 09:57:19] ERROR - file: ../client/client_func.c, line: 257, "/home/yuqing/fastdfs" can't be accessed, error info: No such file or directory
解决如下:
vim /etc/fdfs/client.conf
将base_path改了,tracker的ip也要改
store_path0=/opt/fastdfs/fdfs_storage
-cp mod_fastdfs.conf /etc/fdfs/ 将mod_fastdfs.conf拷贝至/etc/fdfs/下统一管理配置文件
-进入如下目录, 运行下面命令将添加到ngignx中
出现这个代表该步成功:
安装可参考菜鸟教程
启动nginx:
/usr/local/webserver/nginx/sbin/nginx
重启nginx
/usr/local/webserver/nginx/sbin/nginx -s reload
nginx安装目录的配置文件
vim /opt/nginx-1.12.2/conf
nginx系统目录的配置文件
vim /opt/nginx-1.12.2/conf/nginx.conf
报错:
./configure
–prefix=/usr/local/nginx
–pid-path=/var/run/nginx/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=/opt/fastdfs-nginx-module/src
然后
make && make install
又报了一个这个错误
/opt/fastdfs-nginx-module/src/common.c:21:25: fatal error: fdfs_define.h: No such file or directory
在common.c里面出现了变量类型不匹配,还有方法名找不到的错误,谷歌一番之后找不到类似的问题,出现一般的问题的英文common.c的依赖文件找不到,但是我的已经安装完成,可以进行依赖,但是出现了变量类型不匹配的问题
vim /opt/fastdfs-nginx-module/src/config
(原来是/usr/local/include)
再次在nginx下执行命令
./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx/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=/opt/fastdfs-nginx-module/src
经过了上述步骤,还是不行,于是参考了这篇文章,终于找到了思路:
https://blog.csdn.net/qq_34898847/article/details/82258453
[root@localhost nginx-1.12.2]# ./configure --add-module=/opt/fastdfs-nginx-module
出现如下报错的解决方案
./configure: error: no /opt/fastdfs-nginx-module/config was found
No rule to make target `/opt/fastdfs-nginx-module/ngx_http_fastdfs_module.c', needed by `objs/addon/fastdfs-nginx-module/ngx_http_fastdfs_module.o'. Stop.
#include “fdfs_define.h”
[root@follow1 nginx-1.12.2]# vim /opt/fastdfs-nginx-module/src/common.c
删掉这两个文件()里面的local
测试一下:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/lmj/tangyan.jpg
192.168.0.197
192.168.0.197
重启:
service fdfs_storaged start
service fdfs_trackerd start
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/lmj/tangyan.jpg
/usr/local/nginx/sbin/nginx
http://192.168.3.203/group1/M00/00/00/wKgDy11pSfqAU-8yAALLQJh-5qk800_big.jpg
location /group1/M00/ {
ngx_fastdfs_module;
}