Friday, October 23, 2015

Fix for accident nginx remove

Fix for accident nginx remove


Problem


I accidentally removed nginx from my Linux Server (Debian Jessie). I did it after my experiments with phusion passenger. I made:

$ sudo rm -rf /etc/nginx
$ sudo rm  /etc/init.d/nginx

And yes, I know that I made a stupid thing :)

After installing nginx by

$ sudo apt-get install nginx


I was able to run it. Test run

$ sudo nginx -t

output:

nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed


See details for solution...




Solution

You need run this:

$ sudo apt-get purge nginx nginx-common nginx-full

It's will remove everything including config files. Don't be scared /usr/share/nginx/ will be in safe if it contains data.


After that you can install nginx again:

$ sudo apt-get install nginx

Testing our install:

$ sudo nginx -t


output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful



Yahoo!!! Everything is OK.

Enjoy!

No comments:

Post a Comment