Nginx configuration failed. awk: cannot open/etc/nginx. conf (No such file or directory), nginxawk
Nginx configuration failed. An error occurred while reinstalling nginx after uninstalling
Wangyaofeng @ wangyaofeng-NJ091AA-AB2-g3721cx :~ $ Sudo apt-get install nginx is reading the package list... the dependency tree of the software package being analyzed is reading status information... after completion, the following additional software packages will be installed: The software package recommended for nginx-common nginx-core: fcgiwrap nginx-doc the following [new] software packages will be installed: nginx-common nginx-core has been upgraded to 0 software packages. Three new software packages have been installed, and 0 software packages have to be uninstalled. 12 software packages have not been upgraded. The software package of 0 B/348 kB needs to be downloaded. After decompression, 1,296 kB of extra space will be consumed. Do you want to continue? [Y/n] y is selecting the unselected Software Package nginx-common. (Reading the database... the system currently has 192360 files and directories installed .) Preparing to unpack.../nginx-common_1.4.6-1ubuntu3.2_all.deb... unpacking nginx-common (1.4.6-1ubuntu3 .. 2)... selecting the unselected package nginx-core. Preparing to unpack.../nginx-core_1.4.6-1ubuntu3.2_amd64.deb... unpacking nginx-core (1.4.6-1ubuntu3 .. 2)... selecting the unselected Software Package nginx. Preparing to unpack... /nginx_1.4.6-1ubuntu3.2_all.deb... unpacking nginx (1.4.6-1ubuntu3. 2 )... processing the trigger for man-db (2.6.7.1-1ubuntu1... processing for ufw (0.34 ~ The trigger of rc-0ubuntu2... processing the trigger for ureadahead (0.100.0-16... ureadahead will be reprofiled on next reboot is setting nginx-common (1.4.6-1ubuntu3. 2 )... setting nginx-core (1.4.6-1ubuntu3. 2 )... awk: cannot open/etc/nginx. conf (No such file or directory) is setting nginx (1.4.6-1ubuntu3. 2 )...
Solution
Reference http://www.111cn.net/sys/nginx/69517.htm
Completely uninstall nginx
When configuring nginx for experiment, the configuration is incorrect, resulting in no access to the virtual host. The nginx configuration file directory (/etc/nginx) has been deleted, and I have not backed up these configuration files, so I want to reinstall nginx.
The following apt-get command is used directly.
Sudo apt-get -- purge remove nginx
Sudo apt-get install nginx
But in fact, no nginx configuration file is automatically generated, and no/etc/nginx directory is generated.
So autoremove
Sudo apt-get -- purge remove nginx
Sudo apt-get autoremove
Sudo apt-get install nginx
Prompt
Awk: cannot open/etc/nginx. conf (No such file or directory)
Although the/etc/nginx directory is generated, only some configuration files are generated.
Conf. d sites-available sites-enabled
Therefore
Sudo apt-get -- purge remove nginx
Sudo apt-get autoremove
Dpkg -- get-selections | grep nginx
List software related to nginx,
Nginx-common deinstall
Then sdfsd
Sudo apt-get -- purge remove nginx-common
Sudo apt-get install nginx
Then OK!