how to install nginx after removed it manually
Solution 1:
Since you managed to install it anyhow first thing you've to do is to remove it completely with the configuration files
Follow these steps to remove it completely and install it again.
-
Open terminal and execute these commands:
sudo apt-get autoremove nginx sudo apt-get --purge remove nginx sudo apt-get autoremove && sudo apt-get autoclean sudo find / | grep nginx | sudo xargs rm -rf
the last command will remove the repository also so you've to add it again by:
sudo add-apt-repository ppa:nginx/stable
Now try to install it again by:
sudo apt-get update && sudo apt-get -f install nginx
Hope it would solve your issue. Reply if you get any error at any particular command describing the command.
This is the output of
sudo dpkg -l | grep nginx
:
ii nginx 1.4.3-1~precise0 small, powerful, scalable web/proxy server
ii nginx-common 1.4.3-1~precise0 small, powerful, scalable web/proxy server - common files
ii nginx-full 1.4.3-1~precise0 nginx web/proxy server (standard version)
whereis nginx
:
nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx /usr/share/man/man1/nginx.1.gz
Solution 2:
The problem you had is that you removed some files that don't belong to package nginx
, the package that installs /etc/nginx files is nginx-common
.
So if you want to recreate the /etc/nginx
files, you should do:
> apt-get install --reinstall nginx-common
In order to determine to which package belongs a file, you should execute dpkg -S <file>
, in this case:
dpkg -S /etc/nginx
nginx-common: /etc/nginx