在配置nginx做实验时配置错了,导致访问不了虚拟主机。一狠心把nginx的配置文件目录(/etc/nginx)都删除了,而且我没有备份这些配置文件,因此想重装nginx。
本来以为直接使用如下apt-get指令
|
1 2 |
$ sudo apt-get --purge remove nginx $ sudo apt-get install nginx |
就可以搞定,但实际上并没有有自动产生nginx的配置文件,连/etc/nginx目录都没产生。
于是autoremove
|
1 2 3 |
$ sudo apt-get --purge remove nginx $ sudo apt-get autoremove $ sudo apt-get install nginx |
提示
|
1 |
awk: cannot open /etc/nginx/nginx.conf (No such file or directory) |
虽然产生了/etc/nginx目录了,但只有部分配置文件
|
1 |
conf.d sites-available sites-enabled |
于是
|
1 2 3 |
$ sudo apt-get --purge remove nginx $ sudo apt-get autoremove $ dpkg --get-selections | grep nginx |
罗列出与nginx相关的软件
|
1 |
nginx-common |
然后卸载并重新安装
|
1 2 |
$ sudo apt-get --purge remove nginx-common $ sudo apt-get install nginx |
参考链接
nginx配置失败,卸载后重装出问题 awk: cannot open /etc/nginx/nginx.conf (No such file or directory),nginxawk
太感谢了 泪目