Skip to content

Instantly share code, notes, and snippets.

@grantmichaels
Created March 8, 2009 23:15
Show Gist options
  • Save grantmichaels/76004 to your computer and use it in GitHub Desktop.
Save grantmichaels/76004 to your computer and use it in GitHub Desktop.
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
# configure log format
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#main error.log
error_log /usr/local/nginx/logs/error.log;
sendfile on;
tcp_nopush on;
#keepalive_timeout 65;
tcp_nodelay off;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml
application/xml+rss text/javascript;
upstream mochiweb {
server grantmichaels.com:8000;
}
server {
listen 80;
server_name grantmichaels.com;
location / {
root path_to_myapp/myapp/priv/www;
index index.html index.htm;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
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://mochiweb;
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment