nginx配置失败,卸载后重装出问题 awk: cannot open /etc/nginx/nginx.conf (No such file or directory)

nginx配置失败,卸载后重装出问题 

 

wangyaofeng@wangyaofeng-NJ091AA-AB2-g3721cx:~$ sudo apt-get install nginx
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
  nginx-common nginx-core
建议安装的软件包:
  fcgiwrap nginx-doc
下列【新】软件包将被安装:
  nginx nginx-common nginx-core
升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 12 个软件包未被升级。
需要下载 0 B/348 kB 的软件包。
解压缩后会消耗掉 1,296 kB 的额外空间。
您希望继续执行吗? [Y/n] y
正在选中未选择的软件包 nginx-common。
(正在读取数据库 ... 系统当前共安装有 192360 个文件和目录。)
正准备解包 .../nginx-common_1.4.6-1ubuntu3.2_all.deb  ...
正在解包 nginx-common (1.4.6-1ubuntu3.2) ...
正在选中未选择的软件包 nginx-core。
正准备解包 .../nginx-core_1.4.6-1ubuntu3.2_amd64.deb  ...
正在解包 nginx-core (1.4.6-1ubuntu3.2) ...
正在选中未选择的软件包 nginx。
正准备解包 .../nginx_1.4.6-1ubuntu3.2_all.deb  ...
正在解包 nginx (1.4.6-1ubuntu3.2) ...
正在处理用于 man-db (2.6.7.1-1ubuntu1) 的触发器 ...
正在处理用于 ufw (0.34~rc-0ubuntu2) 的触发器 ...
正在处理用于 ureadahead (0.100.0-16) 的触发器 ...
ureadahead will be reprofiled on next reboot
正在设置 nginx-common (1.4.6-1ubuntu3.2) ...
正在设置 nginx-core (1.4.6-1ubuntu3.2) ...
awk: cannot open /etc/nginx/nginx.conf (No such file or directory)
正在设置 nginx (1.4.6-1ubuntu3.2) ...



 

解决办法 
参考 http://www.111cn.net/sys/nginx/69517.htm 


完全卸载nginx 

在配置nginx做实验时配置错了,导致访问不了虚拟主机。一狠心把nginx的配置文件目录(/etc/nginx)都删除了,而且我没有备份这些配置文件,因此想重装nginx。 

    本来以为直接使用如下apt-get指令 

        sudo apt-get --purge remove nginx 
        sudo apt-get install nginx 

    就可以搞定,但实际上并没有有自动产生nginx的配置文件,连/etc/nginx目录都没产生。 
    于是autoremove 

        sudo apt-get --purge remove nginx 
        sudo apt-get autoremove 
        sudo apt-get install nginx 

    提示 

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

    虽然产生了/etc/nginx目录了,但只有部分配置文件 

        conf.d sites-available sites-enabled 

    于是 

        sudo apt-get --purge remove nginx 
        sudo apt-get autoremove 

        dpkg --get- selections|grep nginx 

    罗列除与nginx相关的软件, 

        nginx-common deinstall 

    然后sdfsd 

        sudo apt-get --purge remove nginx-common 
        sudo apt-get install nginx 

    然后OK!

nginx配置失败,卸载后重装出问题 awk: cannot open /etc/nginx/nginx.conf (No such file or directory)

标签:nginx   awk cannot open etcn   

原文:http://blog.csdn.net/wyfhist/article/details/46319059

猜你喜欢

转载自blog.csdn.net/Luenci379/article/details/83758135