首页 > 解决方案 > 为什么 yum 在 RHEL7 上的 yum 更新上重新创建默认的 nginx 配置文件?

问题描述

我在 RHEL7 上通过 yum 包安装了 nginx。我将我的配置添加为

/etc/nginx/conf.d/my.conf

并删除了包装附带的配置文件

/etc/nginx/conf.d/default.conf

最近,通过 yum update 更新了 nginx 包。现在,default.conf 文件再次出现。我本来希望 yum 不会触及默认配置文件,如果它们被更改或删除。

这是正常的百胜行为吗?这里有一些关于 RHEL 版本和 nginx 包的信息。

root@host: [~]# yum info nginx
Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos
This system is receiving updates from RHN Classic or Red Hat Satellite.
Installed Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.14.1
Release     : 1.el7_4.ngx
Size        : 2.6 M
Repo        : installed
From repo   : nginx
Summary     : High performance web server
URL         : http://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.

我将包从 1.14.0 升级到上面显示的 1.14.1 版本。

root@host: [~]# nginx -v
nginx version: nginx/1.14.1

红帽版本:

root@host: [~]# hostnamectl 
   Static hostname: host.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: SOME-ID
           Boot ID: ANOTHER-ID
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.5:GA:server
            Kernel: Linux 3.10.0-862.14.4.el7.x86_64
      Architecture: x86-64

如果我将 my.conf 重命名为 default.conf,它不会在 yum 更新时被替换。

标签: nginxcentosyumrhelrhel7

解决方案


推荐阅读