当前位置:   article > 正文

卸载nginx 并重新安装

卸载nginx
完全卸载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!
本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/947695
推荐阅读
相关标签
  

闽ICP备14008679号