Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49221

Nginx reverse proxy , Apache Drupal and Boost

$
0
0

A nice way to add performance to your drupal site is by adding Nginx in front of your web server to act as a reverse proxy. I have summarized my configuration which puts Nginx in front of an existing Apache / drupal site. Not only can it serve images and other static files, but I have made the tweaks to the configuration file to serve up the boost cached files directly from the Nginx front end.

My testing shows it to be very, very quick. The best thing, is that it can be tested on a production server with no impact.

Nginx Configuration piece is below. For full details, see the write up here: http://www.redbarontechnologies.com/content/configuring-nginx-apache-dru...

location / {
index index.html index.htm;

root /var/www/yourdocroot;

adding boost

set $boost "";
set $boost_query "_";

if ( $request_method = GET ) {
set $boost G;
}

if ($http_cookie !~ "DRUPAL_UID") {
set $boost "${boost}D";
}

if ($query_string = "") {
set $boost "${boost}Q";
}

if ( -f /var/www/yourdocroot/cache/normal/$host$request_uri$boost_query.html ) {
set $boost "${boost}F";
}

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if ($boost = GDQF){
rewrite ^.*$ /cache/normal/$host/$request_uri$boost_query.html break;
}
if ($boost !~ GDQF) {
proxy_pass http://www.yourexistingserver.com;
}
}


Viewing all articles
Browse latest Browse all 49221

Trending Articles