前言:本文主要是記錄阿里云服務(wù)器(Ubuntu16.04)nginx重新安裝失敗的問題
錯誤一
Failed to start A high performance web server and a reverse proxy server
有其他web服務(wù)器占用端口,檢查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)
如果出現(xiàn)上面的信息,則需要強(qiáng)制關(guān)閉進(jìn)程
kill -9 10390
錯誤二
dpkg: error processing package nginx-core (--configure):
出現(xiàn)此錯誤,估計(jì)是因?yàn)閚ginx安裝依賴包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