I use the latest Puma v1.4.0 from rubygems.
Make sure you have nginx installed with these options:
>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15
built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
I use the latest Puma v1.4.0 from rubygems.
Make sure you have nginx installed with these options:
>/opt/nginx/sbin/nginx -V
nginx version: nginx/1.0.15
built by gcc 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
server { | |
listen 80 default; | |
server_name example.com; | |
client_max_body_size 4G; | |
keepalive_timeout 5; | |
root /u/app/fruitwood/current/public; | |
try_files $uri/index.html $uri.html $uri @unicorn; | |
location @unicorn { |
base: &base | |
adapter: sqlite3 | |
timeout: 5000 | |
development: | |
database: <%= shared_path %>/db/development.sqlite3 | |
<<: *base | |
test: | |
database: <%= shared_path %>/db/test.sqlite3 | |
<<: *base | |
production: |
<meta name="author" content="{{ site.author }}"> | |
{% capture description %}{% if page.description %}{{ page.description }}{% elsif site.description %}{{ site.description }}{%else%}{{ content | raw_content }}{% endif %}{% endcapture %} | |
<meta name="description" content="{{ description | strip_html | condense_spaces | truncate:150 }}"> | |
{% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{%else%}<meta name="keywords" content="{{ site.keywords }}">{% endif %} |
[user] | |
name = xxxx | |
email = [email protected] | |
[alias] | |
co = checkout | |
ci = commit -a -v | |
st = status | |
br = branch | |
throw = reset --hard HEAD | |
throwh = reset --hard HEAD^ |
wget -m -p -E -k -K -np http://twitter.github.io/bootstrap/ |
通过json访问新浪ip数据库,可以获得相应城市的ip地址。 | |
例行惯例,不解释: | |
<script type="text/javascript" > | |
$(document).ready(function(){ | |
jQuery.getScript("http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js", function(){ | |
alert("province : "+remote_ip_info.province+", city : "+remote_ip_info.city); | |
}); | |
}); |
// Load libraries | |
var https = require('https'); | |
var fs = require('fs'); | |
var socketio = require('socket.io'); | |
// The server options | |
var svrPort = 8888; // This is the port of service | |
var svrOptions = { | |
key: fs.readFileSync('certs/server.key'), | |
cert: fs.readFileSync('certs/server.crt'), |
Creating and Signing Your Certs | |
This is SSL, so you'll need an cert-key pair for you/the server, the api users/the client and a CA pair. You will be the CA in this case (usually a role played by VeriSign, thawte, GoDaddy, etc.), signing your client's certs. There are plenty of tutorials out there on creating and signing certificates, so I'll leave the details on this to someone else and just quickly show a sample here to give a complete tutorial. NOTE: This is just a quick sample of creating certs and not intended for production. | |
# Create the CA Key and Certificate for signing Client Certs | |
openssl genrsa -des3 -out ca.key 4096 | |
openssl req -new -x509 -days 365 -key ca.key -out ca.crt | |
# Create the Server Key, CSR, and Certificate | |
openssl genrsa -des3 -out server.key 1024 | |
openssl req -new -key server.key -out server.csr |