user  deploy;
worker_processes 1;

error_log logs/error.log debug;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include conf/mime.types;
default_type application/octet-stream;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;
tcp_nodelay on;

gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain;

include conf/mephistoblog.conf;
include conf/fakeornot.conf;
include conf/beast.conf;
include conf/mirid.conf;
}

## fakeornot.conf
# basic RoR app config
upstream fakeornot {
server 127.0.0.1:8300;
}

server {
listen 80;
server_name isitfakeornot.com;
root /var/www/apps/fakeornot/current/public;
index index.html index.htm;

location / {
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;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}

if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}

if (!-f $request_filename) {
proxy_pass http://fakeornot;
break;
}
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

## mephistoblog.conf
# mephisto w/ multi-sites
upstream mephisto {
server 127.0.0.1:8100;
}

server {
listen 80;
root /var/www/apps/publishwithimpunity/current/public;
index index.html index.htm;

location / {
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 (-f $document_root/cache/$host$uri/index.html) {
rewrite (.*) /cache/$host$1/index.html break;
}

if (-f $document_root/cache/$host$uri.html) {
rewrite (.*) /cache/$host$1.html break;
}

if (-f $document_root/cache/$host$uri) {
rewrite (.*) /cache/$host$1 break;
}

proxy_pass http://mephisto;
}

location /admin {
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;
proxy_pass http://mephisto;
}

location ~ ^/assets/\d+/ {
rewrite ^/assets/(\d+)/(.+)$ /assets/$host/$1/$2 last;
}

location /assets {}
location /cache {}
location ~ ^/(images|javascripts|stylesheets)/mephisto {}

location /mint {
rewrite ^/mint$ http://$host/mint/ redirect;
if (!-f $request_filename) {
rewrite ^/mint(/(\?.*))?$ /mint/index.php$2 last;
}
gzip off;
keepalive_timeout 15;
fastcgi_pass 127.0.0.1:8110;
fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /var/www/apps/publishwithimpunity/current/public/$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;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

## conf/mime.types
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;

text/plain txt;
text/x-component htc;
text/mathml mml;

image/png png;
image/x-icon ico;
image/x-jng jng;
image/vnd.wap.wbmp wbmp;

application/java-archive jar war ear;
application/mac-binhex40 hqx;
application/pdf pdf;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/zip zip;

application/octet-stream deb;
application/octet-stream bin exe dll;
application/octet-stream dmg;
application/octet-stream eot;
application/octet-stream iso img;
application/octet-stream msi msp msm;

audio/mpeg mp3;
audio/x-realaudio ra;

video/mpeg mpeg mpg;
video/quicktime mov;
video/x-flv flv;
video/x-msvideo avi;
video/x-ms-wmv wmv;
video/x-ms-asf asx asf;
video/x-mng mng;
}