Kung Fu Kung Fu

Fujian White Crane Kung Fu

Zope Zope

What I have and am doing with Zope

Photos Photos

Photoalbum, both old and new.

Receptsamlingen Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me Contact me

My contact details and how to contact me.

  Mobile version of this page Mobile version of this page


 

How to uninstall nginx with apt

jan, nginx, uninstall, apt, apt-get

28th of March 2008

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.


Comment

Parand - 29th March 2008  [«« Reply to this]
What 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.
Peter Bengtsson - 31st March 2008   [«« Reply to this]
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.
Peter Bengtsson - 10th April 2008   [«« Reply to this]
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!)
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.