Trying to install nginx-cache-purge on unbuntu 12.04


#1

I was following your tutorial on adding the cache purge addition when I found your plugin and saw that it was necessary.

I had already installed nginx (I’m new only 1 week using it) and it seems to work great on my digitalocean setup. I have nginx+varnish+apc+ffp+wordpress from following other tutorials prior to finding the rtcamp site tutorials.

I went to brians site https://launchpad.net/~brianmercer/+archive/nginx and see that he now supports unbuntu 12.04 which is awesome, but when I try to apt-get install nginx-custom, I get the following error, and I don’t know where to begin to fix this.

If I need to remove my install of nginx first, could someone point me out how to do that the right way?

error:

# apt-get install nginx-custom
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
nginx-common
The following NEW packages will be installed:
nginx-common nginx-custom
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/522 kB of archives.
After this operation, 1,176 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database … 41154 files and directories currently installed.)
Unpacking nginx-common (from …/nginx-common_1.4.1-0ppa~precise_all.deb) …
dpkg: error processing /var/cache/apt/archives/nginx-common_1.4.1-0ppa~precise_all.deb (–unpack):
trying to overwrite ‘/etc/logrotate.d/nginx’, which is also in package nginx 1.4.2-1~lucid
No apport report written because MaxReports is reached already
Unpacking nginx-custom (from …/nginx-custom_1.4.1-0ppa~precise_amd64.deb) …
dpkg: error processing /var/cache/apt/archives/nginx-custom_1.4.1-0ppa~precise_amd64.deb (–unpack):
trying to overwrite ‘/usr/sbin/nginx’, which is also in package nginx 1.4.2-1~lucid
No apport report written because MaxReports is reached already
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Processing triggers for man-db …
Processing triggers for ufw …
Errors were encountered while processing:
/var/cache/apt/archives/nginx-common_1.4.1-0ppa~precise_all.deb
/var/cache/apt/archives/nginx-custom_1.4.1-0ppa~precise_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

#2

You can try removing previous installed nginx packages.

Use apt-get remove so that only binaries will be removed. Still backup /etc/nginx folder.

After removing old packages, you can try installing fresh ones again.


#3

Also your error shows lucid packages. If you are on Ubuntu 12.04, then have a look at /etc/apt/ entries.

Looks like your system has some old ubuntu repos added to it.


#4

Thanks Rahul
Actually I gave up a few hrs ago and simply erased my droplet and started over using just your settings. I had no problem of course getting it to work then.

This time I am not going to use varnish, but I am going to do my best to follow all of your tutorials and stats letter by letter (well adjusting for my mini-server of course) as I believe in reading that you probably have the most optimized system available.

I only wish I had found your site a week ago. I knew about it, but had no idea about the nginx specialty you guys provide. I’ve now read every single article multiple times and actually wish you had more information believe it or not…lol

btw
w3-total-cache or super-cache, or what?
Now that I do not have varnish and only have apc running, what do you suggest as the most stable best to work with?

Im going to guess w3 as all your articles seem focused on it…


#5

Actually I’m confused.

Your nginx table shows the w3 and fastcgi_cache as separate config files as though if you use one you don’t use the other.

I went through and added fastcgi, so do I not need w3 now?


#6

We use fastcgi_cache for page caching.

w3tc plugin is used for object/mysql cache (with APC backend) only.

Apart from that w3tc is used for CDN.

By the way, since you have a fresh server (or reset if its few minute old), try https://github.com/rtCamp/easyengine

curl -sL rt.cx/ee | sudo bash  
ee system install all  
ee site create wpsingle wpfc example.com

Above 3 lines will be enough to have all packages installed on a fresh server and create example.com single-wordpress site with fastcgi_cache configured with it.


#7

@Rahul
Thank you for the link. Itg is now 9am and I am at the end of a 38hr straight day. I’ve installed/reinstalled so many times now that I quit keeping count and I have read every single article on your entire site here for optimizing the server. It has been a great help.

When I blitz the site now, it is actually horrible compared to my old varnish server and I have spent the last couple of hours working to figure out why. So far it seems that everything is setup and working correctly, but my times are downright lousy.

This rush generated 5,134 successful hits in 1.0 min and we transferred 62.78 MB of data in and out of your app. The average hit rate of 81/second translates to about 7,051,936 hits/day.

The average response time was 164 ms.

You’ve got bigger problems, though: 13.06% of the users during this rush experienced timeouts or errors!

Varnish:

This rush generated 5,961 successful hits in 1.0 min and we transferred 67.18 MB of data in and out of your app. The average hit rate of 95/second translates to about 8,221,668 hits/day.

The average response time was 236 ms.

I had zero timeouts or errors on the prior 7 tests with varnish, this was just an avg test

So, obviously I have some homework to do and some learning ahead of me.

At the least, I can say that I am learning more about setting up a server than I ever thought I would learn and with no gui even, so that’s cool.


#8

EasyEngine is supposed to make things easy as its name suggest. It won’t make performance difference, atleast for now. In future, it will have magic for auto-tuning! :wink:

Now about performance difference, first and obvious question - was caching enabled properly?

Did you check nginx error log? It may give you hint. If nginx ran out of filesystem descriptors, you can try http://rtcamp.com/wordpress-nginx/tutorials/php/fpm-sysctl-tweaking/

If its upstream error, that means cache wasn’t running.

Also check gzip compression - http://rtcamp.com/wordpress-nginx/tutorials/nginx/enable-gzip/ (I posted this article 3-4 hours back only)

Also, turn off unnecessary access logs as it adds additional disk I/O for every request.

There is so much we can do! Just have a look at nginx’s error log for site you were testing… :slight_smile:


#9

I noticed that somehow I have nginx 1.4.1 instead of 1.4.2

I believe it happened when I was following the tutorial to add in the extra module for the wordpress plugin to flush the page cache.

Is there a guide on how to upgrade nginx to the latest vs. without loosing the extra modules that I worked so hard to make sure were there during the install?


#10

error log only has 1 error:
2013/07/25 08:24:18 [error] 2076#0: *882 access forbidden by rule, client: x.x.x.x, server: mysite.com, request: “GET /nginx_status HTTP/1.1”, host: “mysite.com

I will go through and check everything else you mentioned before I crash n burn for the day/night


#11

this was a private reply with post_id 43278


#12

You need to add your own IP or remove deny all from location /nginx_status {…} block to get away with forbidden error.


#13

Thanks, yes I have no problem accessing the status page. I only made the change so that you could see them as well if needed to help troubleshoot my setup. I have also added the fpm status page so I can watch that, though I’m not really sure when looking at the pages as to what is good and bad numbers. I just know that when I blitz my server right now to test it, I get a lot of timeouts where under the old way with varnish I didn’t. That leads me to believe that maybe I have something configured wrong even though it seems that everything is working.


#14

Ok, I think I get it. I basically have to download all the extra modules that I want to use to my own server and actually add the paths to them each and every time I rebuild. Makes sense I think. Thanks for the info


#15

Yep. :slight_smile:

Sometime extra modules have dependencies. You can go trail-and-error. It may take time but this is the way to build it!

You may find this useful - https://github.com/vladgh/VladGh.com-LEMP

I gave it a try almost 2 years back and it worked then. :slight_smile:


#16

Yes it does work, I tried it a couple of days ago.
Basically I am trying to learn how to do this on my own using best practices.

I have never had to add modules with dependencies before and trying to find docs on how best to do it with multiple dependencies has been a challenge.

Most sites give you a good example on how to load their own dependency for nginx, but I have yet to find a guide showing how to load multiple modules with multiple dependencies when re-building nginx. I suppose that is where I’m at now so that I don’t have to rely upon someone elses script, I can simply rebuild nginx everytime I find a new module with dependencies that I want to use. Trying to become self-sufficient in that :slight_smile:


#17

I always resolve dependencies by trial-n-error.

Just start compilation. Process will break if a dependency is missing. Google for error. Install dependency. Start again!

I keep taking notes of dependencies on the way so if I need to repeat compilation process later on, I can save some time.


#18

Well I’m 3 days into this now and have literally tried everything I can think of. I’ve destroyed and recreated my applet dozens of times and never can get it right, so need to ask for some help.

I followed your awesome guide for fastcgi

Now I just want to add the google pagespeed to that package somehow.

Would you please consider writing up a quick how-to guide on how we should go about upgrading nginx (his is old 1.4.1 vs.) and also how to add pagespeed as well to it?

*I don’t think that there is an article anywhere online on how to compile nginx with lots of different 3rd party modules and built in extensions where you can also auto update via apt-get. If there is, I would love to have the link as I have searched everywhere and tried everything I can think of.


#19

We are already working on nginx build with google-pagespeed. We will post about it in future.


#20