无法在 ubuntu 14.04 上安装 nginx

无法在 ubuntu 14.04 上安装 nginx

我在 14.04 上安装 nginx 时一直收到此错误

sudo apt-get install nginx
[sudo] password for : 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  nginx
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
1 not fully installed or removed.
Need to get 449 kB of archives.
After this operation, 1,004 kB of additional disk space will be used.
Get:1 http://nginx.org/packages/ubuntu/ saucy/nginx nginx amd64 1.6.0-1~saucy [449 kB]
Fetched 449 kB in 5s (83.9 kB/s)
Selecting previously unselected package nginx.
(Reading database ... 245435 files and directories currently installed.)
Preparing to unpack .../nginx_1.6.0-1~saucy_amd64.deb ...
----------------------------------------------------------------------

Thanks for using nginx!

Please find the official documentation for nginx here:
* http://nginx.org/en/docs/

Commercial subscriptions for nginx are available on:
* http://nginx.com/products/

----------------------------------------------------------------------
Unpacking nginx (1.6.0-1~saucy) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.6.0-1~saucy_amd64.deb (--unpack):
 trying to overwrite '/usr/sbin/nginx', which is also in package nginx-light 1.4.6-1ubuntu3.1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/nginx_1.6.0-1~saucy_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

有人可以帮忙吗?

谢谢,


我也无法删除 nginx-light

sudo apt-get purge nginx-light
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  nginx-light*
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
1 not fully installed or removed.
After this operation, 763 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 244088 files and directories currently installed.)
Removing nginx-light (1.4.6-1ubuntu3.1) ...
invoke-rc.d: initscript nginx, action "stop" failed.
dpkg: error processing package nginx-light (--purge):
 subprocess installed pre-removal script returned error exit status 1
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
2014/10/20 07:48:56 [emerg] 4626#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 nginx-light
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

尝试创建 NGINX 抱怨的文件:

sudo touch /var/log/nginx/error.log
sudo touch /etc/nginx/nginx.conf

然后尝试删除它:

sudo apt-get install nginx-light

最后,安装NGINX:

sudo apt-get install nginx

相关内容