文件服务器fastdfs安装配置【草稿】

前言

请参考下列先行者的各个文档:


FastDFS : 开启钻牛角尖模式搞FastDFS集群

CentOS7搭建FastDFS V5.11分布式文件系统及Java整合详细过程(一)

FastDFS教程Ⅲ-文件服务器扩容

Ubuntu下FastDFS分布式文件系统配置与部署

推荐:

Ubuntu下安装并配置FastDFS

FastDFS搭建单机图片服务器(一)

抄录-ubuntu下面配置 fastdfs

这里不得不抄录一下安装过程,因为 非常顺利就可以配置完成了。

FastDFS是一个开源的轻量级分布式文件系统,它对文件进行管理,功能包括:文件存储、文件同步、文件访问(文件上传、文件下载)等,解决了大容量存储和负载均衡的问题。特别适合以文件为载体的在线服务,如相册网站、视频网站等等。

FastDFS的项目主页:https://github.com/happyfish100/fastdfs

本文以Ubuntu 14.04 32位操作系统为例进行安装,FastDFS版本为5.08。(宿主机是一台老式iMac,不支持64位的Ubuntu虚拟机安装)

第一步:安装Git
fastdfs依赖libfastcommon,需要从github上clone到本地编译安装。因此首先需要安装git。

执行命令:

apt-get install git


第二步:克隆libfastcommon库
libfastcommon的源在项目 https://github.com/happyfish100/libfastcommon 需要使用git将其clone至本地安装。

执行命令:

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

第三步:安装libfastcommon依赖
进入libfastcommon目录,依次执行脚本:

./make.sh
和
./make.sh install
如图:


第四步:设置环境变量和软链接
在32位ubuntu中,libfastcommon会安装在/usr/lib 中,64位系统则安装在 /usr/lib64 中。依次执行以下命令:(根据自己的操作系统选择路径)

export LD_LIBRARY_PATH=/usr/lib/
和
ln -s /usr/lib/libfastcommon.so /usr/local/lib/libfastcommon.so


第五步:下载、解压并安装FastDFS
FastDFS的Github下载地址为:https://github.com/happyfish100/fastdfs/releases

下载完成后,执行命令:

tar xzf fastdfs-5.08.tar.gz 

进入解压后的目录,依次执行:
./make.sh 
和
./make.sh install
如图:


第六步:修改配置文件
在默认安装路径 /etc/fdfs 下,有三个示例配置文件:



首先将这三个文件名中的sample去掉,改为:



然后修改 tracker.conf 文件中的日志存放路径 和 tracker server HTTP端口号:

# the base path to store data and log files
base_path=/home/fastdfs/log
注意,这个路径是根据实际情况自定义的,文件路径需要安装者手动创建,否则后续步骤会报“路径不存在”的错误,下同。
# HTTP port on this tracker server
http.server_port=8090
接下来修改 storage.conf 文件:
group_name=group1
store_path0=/home/fastdfs/storage0
base_path=/home/fastdfs/log
tracker_server=192.168.1.108:22122
http.server_port=8888
配置文件里有详细注释说明,这里不再赘述每个参数的作用。
继续修改 client.conf 文件:

base_path=/home/fastdfs/log
tracker_server=192.168.1.108:22122
http.tracker_server_port=8888
#include http.conf

注意,#include http.conf 这句,原配置文件中有2个#,删掉一个。
最后,修改 http.conf 文件。http.conf 文件在解压目录的conf目录下,里面有个默认图片路径,愿意改就改了吧。

http.anti_steal.token_check_fail=/home/fastdfs/anti-steal.jpg
最后确认一下,四个配置文件:


第七步:启动服务
依次执行:

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf

如果上一步配置文件中的自定义路径没创建,有可能报这个错误:

手动创建目录即可。
执行以下命令,验证服务:

neps -ef |grep fdfs


第八步:测试上传文件
首先准备一张图片文件,例如:/home/software/qq.jpg

将这张图片上传至FastDFS,执行:

fdfs_test /etc/fdfs/client.conf upload /home/software/qq.jpg


上传成功,生成了两个文件。
--------------------- 
作者:系统信息 
来源:CSDN 
原文:https://blog.csdn.net/softwave/article/details/54017095 
版权声明:本文为博主原创文章,转载请附上博文链接!
单机下的配置:

创建几个后面能用到的目录
mkdir /home/fastdfs/
mkdir /home/fastdfs/storage
mkdir /home/fastdfs/storage/storage-image
mkdir /home/fastdfs/tracker
mkdir /home/fastdfs/client
mkdir /home/fastdfs/fast-nginx

tracker:

上述安装成功后,在/etc/目录下会有一个fdfs的目录,进入它。会看到三个.sample后缀的文件,这是作者给我们的示例文件,我们需要把其中的tracker.conf.sample文件改为tracker.conf配置文件并修改它。 
1、复制重命名配置文件 
cd /etc/fdfs 
cp tracker.conf.sample tracker.conf

2、打开 
vim tracker.conf

主要修改两个参数

base_path=/home/fastdfs/tracker

http.server_port=80


storage:

现在开始配置 Storage 服务,由于我这是单机器测试,你把 Storage 服务放在多台服务器也是可以的,它有 Group(组)的概念,同一组内服务器互备同步,这里不再演示。

1、复制重命名配置文件 
cd /etc/fdfs 
会看到三个.sample后缀的文件,我们需要把其中的storage.conf.sample文件改为storage.conf配置文件并修改它

cp storage.conf.sample storage.conf

2、打开文件 
vim storage.conf

修改几个参数

group_name=group1
base_path=/home/fastdfs/storage/storage-image
store_path0=/home/fastdfs/storage/storage-image
tracker_server=192.168.86.131:22122

192.168.86.131改成你的本机ip。

如果部署的是阿里云ECS服务器, 
tracker_server=公网ip:22122

stroage的port=23000这个端口参数也不建议修改,默认就好,除非你已经占用它了。 
修改完成保存并退出 vim ,这时候我们依然想优雅地启动 Storage服务,带目录的命令不够优雅,这里还是使用ln -s 建立软链接。
--------------------- 
作者:MissEel 
来源:CSDN 
原文:https://blog.csdn.net/MissEel/article/details/80856194 
版权声明:本文为博主原创文章,转载请附上博文链接!


验证是否已经启动

sudo service fdfs_storaged start 命令启动后,ps-ajx|grep fdfs 查看不到 fdfs_storaged启动信息

可能原因1:

    修改tracker_server=ip地址:22122

    ip地址不要写 127.0.0.1,要写(ifconfig命令后显示的那个ip地址)不过,本机的话可以写localhost
--------------------- 
作者:linux_jiawei 
来源:CSDN 
原文:https://blog.csdn.net/tiexhehongfei/article/details/80013528 
版权声明:本文为博主原创文章,转载请附上博文链接!
到这一步已经正常启动了tracker和storage服务。 
指定命令尝试两者进行通信 
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf

启动正常的话,就可上传图片了,但是目前还无法下载。
第八步:测试上传文件
首先准备一张图片文件,例如:/home/software/qq.jpg

将这张图片上传至FastDFS,执行:

fdfs_test /etc/fdfs/client.conf upload /home/software/qq.jpg


上传成功,生成了两个文件。

抄录-centos或者ubuntu下面nginx配置fastdfs的扩展具体方案

FastDFS搭建单机图片服务器(二)
根据 
分布式文件系统 - FastDFS 在 CentOS 下配置安装部署 
和 
分布式文件系统 - FastDFS 配置 Nginx 模块及上传测试 
一步一步搭建的,但还是碰到了版本太低,导致安装报错的问题。

费时间解决了问题之后,我将这个步骤和对应的版本记录下载,有需要的小伙伴可以参考一下。 
用这个步骤,我已经在一部本机的虚拟机和一部阿里云服务器上分别搭建过,并且能上传和下载图片。

搭建单机服务器的还是比较简单的。我分成了两篇来进行记录。

FastDFS搭建单机图片服务器(一)

主要是下载、安装和配置FastDFS相关的组件,实现图片的上传。
FastDFS搭建单机图片服务器(二)

主要是下载、安装和配置nginx相关的组件,实现图片的下载。
接着上一篇(一)来继续安装nginx的步骤。

一、安装nginx需要准备的环境(CentOS)
1、安装gcc 
安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境,如果没有 gcc 环境,则需要安装: 
yum install gcc-c++

2、 安装PCRE pcre-devel 
PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。nginx也需要此库。命令: 
yum install -y pcre pcre-devel

3、安装zlib 
zlib 库提供了很多种压缩和解压缩的方式, nginx 使用 zlib 对 http 包的内容进行 gzip ,所以需要在 Centos 上安装 zlib 库。 
yum install -y zlib zlib-devel

4、安装OpenSSL 
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。 
nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http),所以需要在 Centos 安装 OpenSSL 库。 
yum install -y openssl openssl-devel

参考资料: 
从零开始学 Java - CentOS 下安装 Nginx

由于ubuntu系统对yum不友好,下载方式不一样。

一、安装nginx需要准备的环境(Ubuntu)
参考资料:ubuntu下安装nginx时依赖库zlib,pcre,openssl安装方法

1、安装gcc 
安装 nginx 需要先将官网下载的源码进行编译,编译依赖 gcc 环境,如果没有 gcc 环境,则需要安装: 
查看是否已经下载: 
dpkg -l | grep gcc 
如果没有则下载安装 
sudo apt-get install g++-5

2、 安装PCRE pcre-devel 
PCRE(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。nginx也需要此库。命令:

sudo apt-get install openssl libssl-dev

3、安装zlib 
zlib 库提供了很多种压缩和解压缩的方式, nginx 使用 zlib 对 http 包的内容进行 gzip ,所以需要在 Centos 上安装 zlib 库。 
查看是否安装 
dpkg -l | grep zlib 
如果没有则下载安装 
sudo apt-get install zlib1g-dev

4、安装OpenSSL 
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。 
nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http),所以需要在 Centos 安装 OpenSSL 库。 
sudo apt-get install openssl libssl-dev

二、下载fastdfs-nginx-module
1、下载 
cd /usr/local 
防止同名压缩包被覆盖,重命名一下已下载的libfastcommon安装包master.zip, 
mv master.zip libfastcommon.zip

wget -c https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip

2、解压 
unzip master.zip

三、下载Nginx
mkdir /usr/local/nginx 
cd /usr/local/nginx 
1、下载 
wget -c https://nginx.org/download/nginx-1.10.1.tar.gz

2、解压nginx-1.10.1.tar.gz 
tar -zxvf nginx-1.10.1.tar.gz

3、安装nginx

加入fastdfs-nginx-module模块。这是和普通 Nginx 安装不一样的地方,因为加载了模块。

cd /usr/local/nginx/nginx-1.10.1/

./configure --add-module=../../fastdfs-nginx-module-master/src/

如果这一步有报错。有些文件显示not found错误。请确保环境准备好了。 
回到第一、安装nginx需要准备的环境,好好确认一下。

如果没有报错,则执行编译

4、编译 
make

如果这里报了难以描述的错误 
解决办法: 
FastDFS版本必须 >= 5.11才可以。否则在使用fastdfs-nginx-module模块整合Nginx时候会出错,编译Nginx的时候会报错。 
解决问题再执行make

5、安装 
make install

6、查看安装成功的版本 
/usr/local/nginx/sbin/nginx -V

四、配置 fastdfs-nginx-module 和 Nginx
1.配置mod-fastdfs.conf,并拷贝到/etc/fdfs文件目录下。 
创建nginx存放日志和数据的目录 
mkdir /home/fastdfs/fast-nginx 
(已创建可以忽略)

2、复制配置文件 
cd /usr/local/fastdfs-nginx-module-master/src/ 
复制配置文件到/etc/fdfs目录下 
cp mod_fastdfs.conf /etc/fdfs

3、修改mod_fastdfs.conf配置文件 
vi /etc/fdfs/mod_fastdfs.conf

修改mod-fastdfs.conf配置只需要修改三个参数就行了,其他不需要也不建议改变。

tracker_server=192.168.86.131:22122
usr_have_group_name=true
store_path0=/home/fastdfs/storage/storage-image
1
2
3
tracker_server=192.168.86.131:22122填本机ip

如果部署的是阿里云ECS服务器, 
tracker_server=公网ip:22122

4、修改config文件 
修改/usr/local/fastdfs-nginx-module-master/src/config文件: 
vi /usr/local/fastdfs-nginx-module-master/src/config 
图中标出的路径要和你的libfastcommon的路径保持一致,可能你的路径中有/local/这一层,如果你安装的目录没有/local/这一层,就将local删除。 


5、拷贝其他配置文件 
接着我们需要把fastdfs-5.11下面的配置中还没有存在/etc/fdfs中的拷贝进去

cd /usr/local/fastdfs-5.11/conf

cp anti-steal.jpg http.conf mime.types /etc/fdfs/

6、配置nginx.conf

cd /usr/local/nginx/conf

vi nginx.conf

编辑内容如下:

location /group1/M00{
     ngx_fastdfs_module;

7、添加软链接 
由于我们配置了group1/M00的访问,我们需要建立一个group1文件夹,并建立M00到data的软链接。

mkdir /home/fastdfs/storage/storage-image/data/group1

ln -s /home/fastdfs/storage/storage-image/data /home/fastdfs/storage/storage-image/data/group1/M00

8、启动 Nginx

/usr/local/nginx/sbin/nginx

五、上传测试
1、配置client.conf 
mkdir /home/fastdfs/client

2、修改配置文件 
cd /etc/fdfs 
重命名 
cp client.conf.sample client.conf 
vi client.conf

修改一下两个参数即可 
base_path=/home/fastdfs/client 
tracker_server=192.168.86.131:22122

如果部署的是阿里云ECS服务器, 
tracker_server=公网ip:22122

3、上传文件 
首先在本地创建一个文件 
/home/kiki/test.txt

上传: 
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/kiki/test.txt 
 
访问url 访问路径



如果访问不了,关闭防火墙 
1) 防火墙,重启后生效 
开启: chkconfig iptables on 
关闭: chkconfig iptables off

2) 防火墙,即时生效,重启后失效 
开启: service iptables start 
关闭: service iptables stop

3)ubuntu系统下 
关闭防火墙:ufw disable 
开启防火墙:ufw enable

再次访问就成功了。
--------------------- 
作者:MissEel 
来源:CSDN 
原文:https://blog.csdn.net/MissEel/article/details/80859865 
版权声明:本文为博主原创文章,转载请附上博文链接!

安装排坑

注意,很多时候意外都会出现,尤其你用的都是最新版本nginx时候,在1.15.7 nginx版本上面编译 nginx - fastdfs - module就出问题了:
在这里插入图片描述

然后检查之:
FastDFS安装Nginx的模块,fastdfs-nginx-module报错:fdfs_define.h:15:27: 致命错误:common_define.h:没有那个文件或目录

这兄dei也遇到了,解决方案:

并且很幸运的找到了解决方法:
编辑 fastdfs-nginx-module-1.20/src/config 文件


ngx_addon_name=ngx_http_fastdfs_module

if test -n "${ngx_module_link}"; then
ngx_module_type=HTTP
ngx_module_name=$ngx_addon_name
ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
ngx_module_libs="-lfastcommon -lfdfsclient"
ngx_module_srcs="$ngx_addon_dir/ngx_http_fastdfs_module.c"
ngx_module_deps=
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='2561024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"
. auto/module
else
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='2561024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"
fi
改成以上内容貌似就可以通过
改变的文件内容

ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

注意!!!千万不要将config的文件完全抄下去,只要将

ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

这两句改了即可,例如:
我的fastdfs config文件是这样的:

修改之前:

在这里插入图片描述

修改之后:

在这里插入图片描述

因为下载来的模块config可能已经变了,不能照抄的!

编译过后,会这样:

在这里插入图片描述

另外提醒:
即使想要降版本,可能也会有麻烦,因为gcc的版本过新,而nginx1.10的这个版本旧,会报错的。

自编译的nginx不适合生产环境

注意,在ubuntu下面,我们会用apt-get nginx来直接安装nginx的。
假如输入
nginx -V命令可以看到:
在这里插入图片描述

而我们刚刚编译的nginx就。。。em:
在这里插入图片描述

一言难尽,什么都没有,所以这种情况如何处理?
请问 apt-get 方式安装的 nginx 如何添加第三方模块?

在这里插入图片描述

首先,我们先下载源代码:

apt-get source nginx

在这里插入图片描述

然后,嗯。。。可以看到的是版本1.140的,离最新版本1.15有距离。。。不过没关系。
然后,下载fastdfs的扩展模块:

wget -c https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip

在这里插入图片描述

重命名,然后解压:

mv master.zip fastdfs-nginx-module.zip
unzip fastdfs-nginx-module.zip

在这里插入图片描述

注意,在source nginx时候已经将nginx 1.14的源代码下载了,就是这里:
在这里插入图片描述

查看一下编译的时候的参数:
在这里插入图片描述

即参数如下:

--with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module

所以我们可以得到编译ubuntu下面的nginx的正式命令:

ls nginx-1.14.0/
./configure --add-module=../fastdfs-nginx-module-master/src/  --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module

如下:
在这里插入图片描述

最后结果:
在这里插入图片描述

嗯。。配置是吧,要模块:
参考一下
Linux Nginx安装以及可能出现错误

apt-get install libxml2 libxml2-dev 
apt-get install libxslt-dev

在这里插入图片描述

在这里插入图片描述

好,继续配置:
在这里插入图片描述

抽丝剥茧,可以查到:
GD Graphics (Draw) Library

在这里插入图片描述

所以,现在的问题在于,如何安装libgd。

在release里面可以看到:
在这里插入图片描述

难道还要手动编译?
不过,ubuntu里面有这软件的:
在这里插入图片描述

直接安装:
在这里插入图片描述

继续:
在这里插入图片描述

the GeoIP module requires the GeoIP library

geoip 模块。。。
嗯,
ubuntu安装GeoIP问题


sudo apt-get install geoip-bin geoip-database

在这里插入图片描述
在这里插入图片描述

继续下一个:
还是提示:


./configure: error: the GeoIP module requires the GeoIP library.
You can either do not enable the module or install the library.

查看一下ubuntu的仓库:
在这里插入图片描述

好了,估计要安装:

libnginx-mod-http-geoip

依然无效。。
偶然查到:
./configure: error: the GeoIP module requires the GeoIP library.

在这里插入图片描述

apt-get install libgeoip-dev

在这里插入图片描述

继续

在这里插入图片描述

终于可以了,内牛满面。。。
好了,安装:

make

然后,
在这里插入图片描述

老问题了。改改:

ngx_module_incs="/usr/include/fastdfs /usr/include/fastcommon/"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"

修改以后再config再make:

在这里插入图片描述

make成功,然后;

make install

在这里插入图片描述

在这里插入图片描述

好了,查看版本号:

/usr/local/nginx/sbin/nginx -V

在这里插入图片描述

?!不对,明明编译的是1.1.40版本的,而且添加了很多插件,为什么还是这个?
然后查一下所有nginx相关目录:
在这里插入图片描述

最后发现在:

/usr/share/nginx 下面才是我们编译的
/usr/share/nginx/sbin/nginx -V

在这里插入图片描述

对比一下目前版本的nginx:
在这里插入图片描述

确实是我们编译的。

好了,下一步我们要替换掉原本apt-get安装的nginx。

请先关停 nginx:

systemctl stop nginx
rm /usr/sbin/nginx
cp /usr/share/nginx/sbin/nginx /usr/sbin/nginx

在这里插入图片描述

替换成功。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值