Archive

Posts Tagged ‘apache’

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 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 , ,

does it get any easier then this?

November 6th, 2006

/etc/httpd/conf.d/rails.conf



  BalancerMember http://10.0.6.130:3000
  BalancerMember http://10.0.6.130:3001
  BalancerMember http://10.0.6.130:3002
  BalancerMember http://10.0.6.130:3003


NameVirtualHost *:80


    ServerName bigbox
    ServerAlias bigbox
    ProxyPass / balancer://rails-cluster/
    ProxyPassReverse / balancer://rails-cluster/
    ErrorLog /var/log/httpd/rails/error_log
    TransferLog /var/log/httpd/rails/access_log

my rails project:
config/mongrel_cluster.yml

---
cwd: /home/taf2/bug-fixes/
port: "3000"
environment: production
address: 10.0.6.130
pid_file: log/mongrel.pid
servers: 4

and for kicks switch environment to development if you’re not testing a session based app.

Software ,