Skip to content

Instantly share code, notes, and snippets.

@Inviz
Created February 18, 2009 02:58
Show Gist options
  • Save Inviz/66160 to your computer and use it in GitHub Desktop.
Save Inviz/66160 to your computer and use it in GitHub Desktop.
user www www;
worker_processes 1;
pid /opt/local/var/run/nginx.pid;
error_log /opt/local/var/log/nginx/error.log info;
events {
worker_connections 16;
}
http {
include etc/nginx/mime.types;
default_type application/octet-stream;
access_log /opt/local/var/log/nginx/access.log;
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;
client_max_body_size 100m;
ignore_invalid_headers off;
upstream merb {
server 127.0.0.1:4000;
}
server {
listen 80;
server_name localhost;
root /Users/inviz/Sites/;
index index.html index.htm;
}
server {
listen 80;
server_name mml.dev *.mml.dev orwik.dev *.orwik.dev *.mymetalab.local mymetalab.local;
#
# Static resources
#
# expiration for static formats used on the Web
location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|js)$
{
# do not add log entries
access_log off;
expires 30d;
break;
}
# serve stylesheets/vendor, that is known to be pure CSS, directly
location ~ ^/stylesheets/vendor/
{
# do not add log entries
access_log off;
expires 30d;
break;
}
location ~* ^/stylesheets/.*\.css$
{
rewrite ^/stylesheets/(.*)$ /stylesheets/compiled/$1 break;
break;
}
# if file exists, serve it and do not proceed any further
if (-f $request_filename)
{
break;
}
root /Users/inviz/Sites/mml2/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 false;
if (-f $request_filename) {
rewrite (.*) $1 break;
}
if (!-f $request_filename) {
proxy_pass http://merb;
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment