This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream serviceA { | |
server 127.0.0.1:88; | |
server 127.0.0.1:88; | |
} | |
upstream serviceB { | |
server 127.0.0.1:89; | |
server 127.0.0.1:89; | |
} | |
upstream serviceC { | |
server 127.0.0.1:90; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#(for apxs) | |
yum install -y httpd-devel | |
cd /usr/local/src/ | |
sudo wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz | |
sudo tar xzf mod_rpaf-0.6.tar.gz | |
cd mod_rpaf-0.6 | |
sudo apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c | |
#Make sure you have keepalive off in httpd.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
... | |
#caching related | |
client_body_temp_path /var/lib/nginx/body 1 2; | |
gzip_buffers 32 8k; | |
gzip on; | |
tcp_nodelay on; | |
gzip_types | |
text/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream wordpress { | |
server 127.0.0.1:80 weight=1 fail_timeout=120s; | |
} | |
server { | |
listen 81; | |
server_name blog.foo.bar; | |
proxy_cache_valid 200 20m; | |
access_log /var/log/httpd/nginx-access.log combined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tail -F /var/log/nginx/blog.foo.bar-access.log& | |
curl --head http://blog.foo.bar:81 | |
"HEAD / HTTP/1.1" 200 0 "-" "-" "HIT" | |
HTTP/1.1 200 OK | |
Server: nginx/0.7.67 | |
Date: Mon, 17 Jan 2011 22:51:44 GMT | |
Content-Type: text/html; charset=UTF-8 | |
Connection: keep-alive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var libpath = require('path'), | |
http = require("http"), | |
fs = require('fs'), | |
url = require("url"), | |
mime = require('mime'); | |
var path = "."; | |
var port = 8088; | |
http.createServer(function (request, response) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* foo.js */ | |
var date = new Date(); | |
exports.Date = date; | |
/* bar.js */ | |
var foo = require('./foo.js'); | |
exports.Date = foo.Date; | |
/* foobar.js */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"header": "Colors", | |
"items": [ | |
{"name": "red", "first": true, "url": "#Red"}, | |
{"name": "green", "link": true, "url": "#Green"}, | |
{"name": "blue", "link": true, "url": "#Blue"} | |
], | |
"empty": false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{header}}</h1> | |
{{#items}} | |
{{#first}} | |
<li> | |
<strong>{{name}}</strong> | |
</li> | |
{{/first}} | |
{{#link}} | |
<li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render : function(view, model, callback) { | |
cst.model = model; | |
cst.view = view; | |
try { | |
var html = Mustache.to_html(view, model); | |
callback.call(this, html); | |
} catch (error) { | |
onError('Error while rendering template.'); | |
} | |
} |