【发布时间】:2019-05-22 00:05:02
【问题描述】:
在我的服务器中,nginx -v 返回nginx version: nginx/1.4.6 (Ubuntu),它很旧,所以我决定将它更新到最新的稳定版本。
然后,我关注了this answer:
sudo apt-get update
sudo apt-get install nginx
它给出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
nginx-common nginx-core
Suggested packages:
fcgiwrap nginx-doc
The following packages will be upgraded:
nginx nginx-common nginx-core
3 upgraded, 0 newly installed, 0 to remove and 311 not upgraded.
Need to get 349 kB of archives.
After this operation, 3,072 B of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main nginx-common all 1.4.6-1ubuntu3.7 [19.0 kB]
Get:2 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main nginx all 1.4.6-1ubuntu3.7 [5,352 B]
Get:3 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main nginx-core amd64 1.4.6-1ubuntu3.7 [325 kB]
Fetched 349 kB in 0s (431 kB/s)
Preconfiguring packages ...
(Reading database ... 111751 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.4.6-1ubuntu3.7_all.deb ...
Unpacking nginx-common (1.4.6-1ubuntu3.7) over (1.4.6-1ubuntu3.5) ...
Preparing to unpack .../nginx_1.4.6-1ubuntu3.7_all.deb ...
Unpacking nginx (1.4.6-1ubuntu3.7) over (1.4.6-1ubuntu3.5) ...
Preparing to unpack .../nginx-core_1.4.6-1ubuntu3.7_amd64.deb ...
Unpacking nginx-core (1.4.6-1ubuntu3.7) over (1.4.6-1ubuntu3.5) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up nginx-common (1.4.6-1ubuntu3.7) ...
Setting up nginx-core (1.4.6-1ubuntu3.7) ...
Setting up nginx (1.4.6-1ubuntu3.7) ...
但是,nginx -v 仍然返回 nginx version: nginx/1.4.6 (Ubuntu)。
有谁知道在不修改配置文件的情况下更新 nginx 的安全方法?因为是在生产中的服务器上,所以要非常小心...
【问题讨论】:
-
为什么要更新到较新的版本?您有新版本解决的具体问题吗?
-
不,我没有具体的原因……升级 nginx 有那么可怕吗?
-
您是否检查过您当前的配置是否与最新版本兼容?您是否要花时间确保最新版本与当前版本的工作方式相同?您可以承受多长时间的生产服务器停机时间? Nginx 的升级并没有那么可怕,但总是有可能发生细微的行为变化,这将完全破坏您的生产,并且需要数小时才能进行调试。尤其是当您同时跳转多个版本时。
-
升级前有没有办法检查当前配置是否兼容最新版本?
-
良好的做法是拥有镜像生产的暂存环境来测试此类更改。或者,您可以使用与生产环境相同的环境设置临时 VM。
标签: ubuntu nginx digital-ocean