ubuntu16.04重新安装nginx失败

前言:本文主要是记录阿里云服务器(Ubuntu16.04)nginx重新安装失败的问题

错误一

Failed to start A high performance web server and a reverse proxy server

有其他web服务器占用端口,检查80端口是否占用

lsof -i:80
COMMAND     PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
AliYunDun 10390 root   23u  IPv4 2664130      0t0  TCP xxx:xxx->xxx:http (ESTABLISHED)

如果出现上面的信息,则需要强制关闭进程

kill -9 10390 

错误二

dpkg: error processing package nginx-core (--configure):

出现此错误,估计是因为nginx安装依赖包nginx-core和nginx-common影响所致

查看nginx的依赖包

dpkg --get-selections | grep nginx
nginx                                           install
nginx-common                                    install
nginx-core                                      install

删除依赖包

apt-get remove nginx
apt-get --purge remove nginx(彻底卸载)
apt-get --purge remove nginx-core 
apt-get --purge remove nginx-common

或者自动删除依赖包,但是删除之后还是要再检查下依赖包是否删除完成

apt-get remove nginx
apt-get autoremove

安装

apt-get install nginx
systemctl start nginx
systemctl status nginx
wget http://localhost
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。