Skip to content

Instantly share code, notes, and snippets.

@alecgorge
Created January 19, 2014 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alecgorge/8500531 to your computer and use it in GitHub Desktop.
Save alecgorge/8500531 to your computer and use it in GitHub Desktop.
iguana nginx conf
upstream iguana_node {
server localhost:9000;
}
upstream iguana_phantom {
server localhost:8888;
}
server {
listen 80;
access_log on;
error_log on;
root /www/var/iguana/public;
index index.html;
server_name marcoallday.com marcoallday.alecgorge.com lotusod.com lotusod.alecgorge.com sts9od.com sts9od.alecgorge.com;
set $is_bot '0';
if ($http_user_agent ~ '(facebookexternalhit|googlebot|bingbot|twitterbot|teoma|Baiduspider)') {
set $is_bot '1';
}
location / {
add_header X-Bot $is_bot;
proxy_cache iguana_cache;
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;
proxy_cache_key "$scheme$host$request_uri$is_bot";
proxy_cache_valid 1d;
add_header X-Cached $upstream_cache_status;
proxy_pass http://iguana_node;
if ($is_bot = '1') {
proxy_pass http://iguana_phantom;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment