nginx.conf 1.37 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
# Mapping of 
#
# From the /mitx directory:
#   /usr/local/Cellar/nginx/1.2.2/sbin/nginx -p `pwd`/ -c nginx.conf

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    ##
    # Basic Settings
    ##
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;
    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /usr/local/etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Gzip Settings
    ##
    gzip on;
    gzip_disable "msie6";

    upstream portal {
        server localhost:8000;
    }

    upstream course_harvardx_cs50_2012 {
        server localhost:8001;
    }

    upstream course_mitx_6002_2012_fall {
        server localhost:8002;
    }

    # Mostly copied from our existing server...
    server {
      listen 8100 default_server;

      rewrite ^(.*)/favicon.ico$ /static/images/favicon.ico last;

      # Our catchall 
      location / {
        proxy_pass http://portal;
      }

      location /courses/HarvardX/CS50x/2012/ {
        proxy_pass http://course_harvardx_cs50_2012;
      }

      location /courses/MITx/6.002x/2012_Fall/ {
        proxy_pass http://course_mitx_6002_2012_fall;
      }
64 65 66 67 68

      location ~ /courses/([^/]*)/([^/]*)/([^/]*)/(course_wiki|wiki) {
        proxy_pass http://portal;
      }

69 70 71 72
    }
}