Archive

Posts Tagged ‘wordpress’

Nginx and wordpress with apache

December 11th, 2008

I was getting quiet a bit of traffic on another wordpress site, I’ve been running.  I had apache as running php and this started to become an issue.  I could upgrade the hardware, but it didn’t seem right - because really it’s not that much traffic…  So, I decided to see if I could put nginx in front of apache.  Here’s what I have now and it’s working out pretty well with the help of one little note from Millarian.

  location / {
    index  index.html index.htm;

    proxy_redirect     off;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

    if ($request_method != GET) {
      proxy_pass http://apache;
      break;
    }

    if ( $request_filename ~* .*\.php) {
      proxy_pass http://apache;
      break;
    }

    # check if the file exists and serve it
    if (-f $request_filename) {
      access_log    off;
      expires       10d;

      break;
    }

    if (!-f $request_filename) {
      proxy_pass http://apache;
      break;
    }
  }

Now all static file’s are served directly by nginx.  Dynamic requests are passed to apache.  I was also able to reduce the value of MaxClients, on the server to avoid running out of memory.  MaxClients in apache controls the number of server processes allowed to start.  With PHP running each apache process can be as large as 30 - 60 megs per process.  This value in fedora core, is set to 256 by default.

Software , ,

google calendar service and safari

October 22nd, 2008

 Fixing the “Unsupported Browser. Continue at your own risk” Error from Google Calendar Javascript API, when using Safari. First of all… why are they using alert with a service? And worse why are they using an alert in a method with no error handler? Anyways, Javascript is a nice language so we can silence google using a little script like the one below:

 var falert = window.alert;
 window.alert = function() { /* silence google */ };
 var calService = new google.gdata.calendar.CalendarService("wpng-calendar-plugin-1");
 window.alert = falert;

Software , , ,