Drupal without Apache

Apologies if this site looked a little odd today. The server this site runs on is extremely busy, and I've recently been taking matters in hand. One thing which needed to happen today was bumping the IP address here up by one.

Since you asked, I've started the process of consolidating all the Drupal sites on this server - there are about 18 if memory serves - into one installation and 18 Drupal multisite configuration files. That allows me to use the Alternative PHP Cache (APC) to store compiled copies of every Drupal source file in RAM, which gives me quite the speed bump.

To top that off, I've also set up the first six or seven of the domains here to dodge Apache altogether and run instead off a brutally-fast lightweight HTTP server from Russia called Nginx. And punted PHP over to a small collection of FastCGI processes sharing the aforementioned APC cache. And then installed PHP 5, in order that Drupal can finally take advantage of the mysqli_* functions available to it and get yet more speed out of versions of MySQL 4.1 and higher.

Eventually I'll remove Apache entirely, but for now I've saved so much memory that we can run both web servers and still have space left over from the mere 1Gb available to us, without hitting the swap file.

Right now it's all about getting more raw speed without dropping any more money. There's some description about how to make Drupal play nice with an unfamiliar web server here.

delicious | digg | reddit


Muz (not verified) | February 1, 2007 - 10:51

we need to get you some more money to run this thing

Anonymous (not verified) | February 12, 2007 - 16:31

hello,

i've read on drupal.org that you moved Wordpress on nginx too... can you please share your rewrite rules as im trying to do the same now but i just can't get it right.

Big thanks.

johnh | February 14, 2007 - 15:29

There is literally nothing to this whatsoever. Just paste in the default PHP stuff and it's fine.

Here (redacted) is what I'm using for the server{} section of nginx.conf on one WP blog:


server {
listen 192.168.0.1:80; # Your server IP here
server_name example.com www.example.com; # Your required FQDNs here
access_log /var/log/path/to/access_log main;
location / {
root /home/someone/webfiles; # Your path here
index index.php index.html index.htm;
}
# This bit serves image/css files directly without invoking PHP
# And returns a 403 error to image leechers
location ~* ^.+.(jpg|jpeg|gif|css|png)$ {
root /home/someone/webfiles;
valid_referers none blocked example.com www.example.com images.google.com images.google.ie images.google.co.uk;
expires 30d;
if ($invalid_referer) {
return 403;
}
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:8888;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/someone/webfiles/$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

----
John H