My colleague Jan showed me how to do this so I'm going to blog about it to not forget and perhaps by being here other people might be able to search and find the solution too. I installed nginx because I wanted to play with it as an alternative to apache on my laptop. Now I've played enough and I'm going to want to remove it. My first attempt didn't work:
peterbe@trillian:~ $ sudo apt-get --purge remove nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
nginx*
0 upgraded, 0 newly installed, 1 to remove and 116 not upgraded.
1 not fully installed or removed.
Need to get 0B of archives.
After unpacking 528kB disk space will be freed.
Do you want to continue [Y/n]?
(Reading database ... 242827 files and directories currently installed.)
Removing nginx ...
Stopping nginx: invoke-rc.d: initscript nginx, action "stop" failed.
dpkg: error processing nginx (--purge):
subprocess pre-removal script returned error exit status 1
Starting nginx: invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error while cleaning up:
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried this both before and after having stopped and started nginx. Nothing worked. The trick is to fiddle with the init script /etc/init.d/nginx
and insert a exit 0
at the top so that it now starts like this:
#!/bin/sh
exit 0
Once saved and you try apt-get --purge remove nginx
it will work. It might warn you that /var/log/nginx
aren't removed because they're not empty but you can safely remove them manually unless you want to keep them.
Comments
Post your own commentWhat was your general impression of nginx and what made you decide to remove it? I've been meaning to give it a try as well, would be interested in hearing your experiences.
I didn't give it a fair test. I just wanted to see if I could get Zope to run behind it. With the kind of work I do, the bottleneck won't be in the fronting server so I wouldn't be able to say if nginx is better than apache.
Watch this video:
http://plone.tv/media/689203036/view
fast forward to about 8 minutes in when he talks about the difference between Apache and Nginx. You'll be impressed by the difference. (hint: Nginx rocks!)
Yes, indeed it rocks
Excellent, vraiment
I have removed Apache
Thanks for the tip!
can any 1 tell me how i can remove nginx from my laptop
I seemed to have uninstalled NGINX but since i installed it i have no internet connection. I think that's because i only have one nic and the webserver was monopolizing port 80. however, not it's uninstalled and i still have no internet.
Thankyou, I was having problems getting the configuration files (/etc/nginx/) back after accidentily deleting them.
I used
apt-get --purge remove ^nginx
apt-get install nginx
and reinstalled and they returned.
how to I get this off my computer - it pops up on my search screen
For us lay peeps, can you please give me the step by step instructions. I just use the computer, I don't know the hardware and software programmings. Thank you!
Hi, there is an other tricks to remove nginx, nginx is a metapackage, so to remove it you should first remove all of its dependencies, to proceed just run "sudo apt-cache show nginx" this will display all nginx's related packages, in my case it was nginx-full nginx-ligh, then run apt-get remove to remove theme ''sudo apt-get remove nginx-full nginx-ligh' ...