|
| 1 | +user www-data; |
| 2 | +worker_processes 4; |
| 3 | +pid /var/run/nginx.pid; |
| 4 | + |
| 5 | +events { |
| 6 | + worker_connections 768; |
| 7 | + # multi_accept on; |
| 8 | +# debug_connection 93.97.184.95; |
| 9 | +} |
| 10 | + |
| 11 | +http { |
| 12 | + include /etc/nginx/mime.types; |
| 13 | + default_type application/octet-stream; |
| 14 | + server_tokens off; |
| 15 | + |
| 16 | + sendfile on; |
| 17 | + tcp_nopush on; |
| 18 | + tcp_nodelay on; |
| 19 | + |
| 20 | + keepalive_timeout 20; |
| 21 | + |
| 22 | + gzip on; |
| 23 | + gzip_http_version 1.0; |
| 24 | + gzip_comp_level 5; |
| 25 | + gzip_min_length 256; |
| 26 | + gzip_disable msie6; |
| 27 | + gzip_proxied any; |
| 28 | + gzip_vary on; |
| 29 | + gzip_types |
| 30 | + application/atom+xml |
| 31 | + application/javascript |
| 32 | + application/x-javascript |
| 33 | + application/json |
| 34 | + application/rss+xml |
| 35 | + application/vnd.ms-fontobject |
| 36 | + application/x-font-ttf |
| 37 | + application/x-web-app-manifest+json |
| 38 | + application/xhtml+xml |
| 39 | + application/xml |
| 40 | + font/opentype |
| 41 | + image/svg+xml |
| 42 | + image/x-icon |
| 43 | + text/css |
| 44 | + text/plain |
| 45 | + text/x-component; |
| 46 | + |
| 47 | + |
| 48 | + # Redirect https to http to fix cached issue in jsbin visitor's browser |
| 49 | + server { |
| 50 | + listen 443; |
| 51 | + ssl on; |
| 52 | + ssl_certificate /WWW/jsbin/jsbin.crt; |
| 53 | + ssl_certificate_key /WWW/jsbin/jsbin.key; |
| 54 | + |
| 55 | + ssl_session_timeout 5m; |
| 56 | + |
| 57 | + ssl_protocols SSLv2 SSLv3 TLSv1; |
| 58 | + ssl_ciphers HIGH:!aNULL:!MD5; |
| 59 | + ssl_prefer_server_ciphers on; |
| 60 | + |
| 61 | + return 301 http://$host$request_uri; |
| 62 | + } |
| 63 | + |
| 64 | + # static.jsbin.com : static server |
| 65 | + server { |
| 66 | + listen 80; |
| 67 | + server_name static.jsbin.com; |
| 68 | + root /WWW/jsbin/public/; |
| 69 | + index index.html; |
| 70 | + access_log /var/log/nginx/static.jsbin.com.log; |
| 71 | + |
| 72 | + # Expire rules for static content |
| 73 | + |
| 74 | + # cache.appcache, your document html and data |
| 75 | + location ~* \.(?:manifest|appcache|html?|xml|json)$ { |
| 76 | + expires -1; |
| 77 | + } |
| 78 | + |
| 79 | + # Media: images, icons, video, audio, HTC |
| 80 | + location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { |
| 81 | + expires 1M; |
| 82 | + access_log off; |
| 83 | + add_header Cache-Control "public"; |
| 84 | + } |
| 85 | + |
| 86 | + # CSS and Javascript |
| 87 | + location ~* \.(?:css|js)$ { |
| 88 | + expires 1y; |
| 89 | + access_log off; |
| 90 | + add_header Cache-Control "public"; |
| 91 | + } |
| 92 | + |
| 93 | + # WebFonts |
| 94 | + location ~* \.(?:ttf|ttc|otf|eot|woff|font.css)$ { |
| 95 | + expires 1M; |
| 96 | + access_log off; |
| 97 | + add_header Cache-Control "public"; |
| 98 | + } |
| 99 | + |
| 100 | + # Try to serve the files, or serve a 404 |
| 101 | + location / { |
| 102 | + try_files $uri $uri/ =404; |
| 103 | + # Cache hard |
| 104 | + add_header Pragma "public"; |
| 105 | + add_header Cache-Control "public, must-revalidate, proxy-revalidate"; |
| 106 | + add_header Last-Modified $sent_http_Expires; |
| 107 | + add_header Access-Control-Allow-Origin *; |
| 108 | + } |
| 109 | + } |
| 110 | + |
| 111 | + # jsbin.com : proxy port 80 traffic to Node |
| 112 | + server { |
| 113 | + listen 80 default_server; |
| 114 | + server_name _; |
| 115 | +# jsbin.com run.jsbin.com www.jsbin.com 3.jsbin.com; |
| 116 | + access_log /var/log/nginx/jsbin.log; |
| 117 | + |
| 118 | + location / { |
| 119 | + # Pass the request on to Node. |
| 120 | + proxy_pass http://localhost:8000; |
| 121 | + |
| 122 | + # Pass a bunch of headers to the downstream server, so they'll know what's going on. |
| 123 | + proxy_set_header Host $host; |
| 124 | + proxy_set_header X-Real-IP $remote_addr; |
| 125 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 126 | + proxy_set_header X-Accel-Buffering no; |
| 127 | + proxy_set_header Connection ''; |
| 128 | + |
| 129 | + proxy_http_version 1.1; |
| 130 | + proxy_buffering off; |
| 131 | + proxy_cache off; |
| 132 | + proxy_redirect off; |
| 133 | + } |
| 134 | + } |
| 135 | +} |
0 commit comments