卸載nginx之後重新安裝沒有重新生成配置文件的解決方法

Ubuntu 14.04上卸載nginx之後重新安裝沒有重新生成配置文件的解決方法

在配置nginx做實驗時配置錯了,導致訪問不了虛擬主機。一狠心把nginx的配置文件目錄(/etc/nginx)都刪除了,而且我沒有備份這些配置文件,因此想重裝nginx

本來以爲直接使用如下apt-get指令

 
 
 
 
 
Shell
 
1
2
$ sudo apt-get --purge remove nginx
$ sudo apt-get install nginx

就可以搞定,但實際上並沒有有自動產生nginx的配置文件,連/etc/nginx目錄都沒產生。
於是autoremove

 
 
 
 
 
Shell
 
1
2
3
$ sudo apt-get --purge remove nginx
$ sudo apt-get autoremove
$ sudo apt-get install nginx

提示

 
 
 
 
 
Vim
 
1
awk: cannot open /etc/nginx/nginx.conf (No such file or directory)

雖然產生了/etc/nginx目錄了,但只有部分配置文件

 
 
 
 
 
Shell
 
1
conf.d sites-available sites-enabled

於是

 
 
 
 
 
Shell
 
1
2
3
$ sudo apt-get --purge remove nginx
$ sudo apt-get autoremove
$ dpkg --get-selections | grep nginx

羅列出與nginx相關的軟件

 
 
 
 
 
Shell
 
1
nginx-common

然後卸載並重新安裝

 
 
 
 
 
Shell
 
1
2
$ sudo apt-get --purge remove nginx-common
$ sudo apt-get install nginx
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章