我在 CentOS 6,nginx 1.6.3
$nginx -v
nginx version: nginx/1.6.3
我想將 nginx 升級到 1.8 因為add_header [always] 指令需要
我正在關注https://webtatic.com/packages/nginx18/進行升級但出現以下錯誤
$yum list nginx*
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* base: mirrors.service.networklayer.com
* epel: free.nchc.org.tw
* extras: mirrors.service.networklayer.com
* updates: mirrors.service.networklayer.com
* webtatic: uk.repo.webtatic.com
Installed Packages
nginx16.x86_64 1.6.3-1.w6 @webtatic
Available Packages
nginx18.x86_64 1.8.0-1.w6 webtatic
當我跑步時yum install -y nginx18
,它給出
Transaction Check Error:
file /usr/sbin/nginx from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
file /usr/lib64/perl5/vendor_perl/auto/nginx/nginx.so from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
file /usr/lib64/perl5/vendor_perl/nginx.pm from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
file /usr/share/man/man3/nginx.3pm.gz from install of nginx18-1.8.0-1.w6.x86_64 conflicts with file from package nginx16-1.6.3-1.w6.x86_64
Error Summary
有人可以指導我在 CentOS 6 上完成將 nginx 從 1.6.3 升級到 1.8 的正確步驟嗎?理想情況下,不要yum remove
-ing nginx16 然後安裝 nginx18,這會導致伺服器停機。
答案1
由於 nginx 軟體包並沒有設計為同時安裝多個版本,因此您需要卸載舊版本並安裝新版本:
$ yum remove nginx16
$ yum install nginx18
或者,您可以嘗試
$ yum install yum-plugin-replace
$ yum replace nginx16 --replace-with=nginx18
$ service nginx restart
但最好先在測試伺服器上進行測試。