Ubuntu: apt-get purge, install nginx; reports success but not installed (12.04)


after removing nginx, I re-installed it with sudo apt-get install nginx.

Output indicated that the installation was successful.

But there's no directory /etc/nginx and sudo service nginx start fails because it can't read the config file.

How can I fix this?


The configuration files are provided by the nginx-common package, not nginx. Therefore you have to purge nginx-common:

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

(nginx depends on nginx-common, removing nginx-common will also remove nginx.)

There is no need to add the nginx PPA just for getting back the configuration files.


To Install nginx:

sudo apt-get install python-software-properties  sudo apt-get install software-properties-common  sudo add-apt-repository ppa:nginx/stable  sudo apt-get update  sudo apt-get install nginx  

To start nginx:

sudo service nginx start  

To check the package installation

 service nginx status  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »