So I've been mucking around with a variety of webservers due to a number of performance concerns with Apache. I first landed on lighttpd, but it had some ambiguous 404 handling that confused Google. From there I decided to try out nginx, which seems to be a popular webserver among, um... Russian spam and porn sites. That does seem a little sketchy at first, but its hard to imagine a site with higher traffic loads than a Russian porn site. For that matter, its hard to imagine a webmaster with less tolerance for crappy software than the kind of Russian mafia lord that might be running said site. So, really, this all seems to be a good sign for nginx!
While getting Drupal to run in a FastCGI environment is well documented, I also need to be able to run my Openads server (AKA Max Media Manager), a setup which proved to be a little trickier. Ultimately, it boiled down to figuring out and providing all of the necessary headers that MMM uses to setup its web environment. It makes a number of unusual decisions based on obscure things like, for example, the SERVER_PORT being set -- if it's not, you won't get a default http:// protocol. So here's my sample nginx server config which, at the moment, seems to work great with MMM running as a standalone FastCGI process.
server { listen 80; server_name ads.example.com; access_log logs/adserver-access.log combined; location / { root /root/to/adserver/www; index index.php; } location ~ .php$ { fastcgi_pass 127.0.0.1:8080; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /root/to/adserver/www$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT /root/to/adserver/www; fastcgi_param PHP_SELF $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SERVER_NAME ads.example.com; fastcgi_param HTTP_HOST ads.example.com; fastcgi_param SERVER_PORT 80; fastcgi_param REMOTE_ADDR $remote_addr; } }
0 comments:
Post a Comment