Skip to content

Instantly share code, notes, and snippets.

@hotchpotch
Created May 25, 2011 04:50
Show Gist options
  • Save hotchpotch/990354 to your computer and use it in GitHub Desktop.
Save hotchpotch/990354 to your computer and use it in GitHub Desktop.
cocproxy for nginx
#!nginx -p . -c cocproxy.nginx.conf
error_log /dev/stderr debug;
daemon off;
events {
worker_connections 48;
}
http {
# include /etc/nginx/mime.types;
types {
application/x-javascript js;
application/x-shockwave-flash swf;
application/xhtml+xml xhtml;
image/gif gif;
image/jpeg jpeg jpg;
image/png png;
image/svg+xml svg;
image/tiff tif tiff;
image/x-icon ico;
text/css css;
text/html html htm shtml;
text/plain txt;
text/x-component htc;
text/xml xml;
}
default_type application/octet-stream;
server {
listen 127.0.0.1:8087;
resolver 8.8.8.8;
root '';
access_log /dev/stdout;
location / {
if (-f $host/$request_filename) {
rewrite ^ $host/$request_filename last;
break;
}
if (-f $request_filename) {
rewrite ^ $request_filename last;
break;
}
proxy_pass http://$host$request_uri;
proxy_set_header Host $host;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment