comparison README.md @ 322:2235aa625af0

Add memcached and nginx config to readme.
author edogawaconan <me@myconan.net>
date Sun, 06 Apr 2014 03:42:02 +0900
parents d6e94d7d0325
children a0166874e31e
comparison
equal deleted inserted replaced
321:fec39456dcbe 322:2235aa625af0
16 * Ruby Bundler 16 * Ruby Bundler
17 17
18 Optional: 18 Optional:
19 19
20 * Newrelic account 20 * Newrelic account
21 * memcached
21 22
22 Suggested: 23 Suggested:
23 24
24 * nginx 25 * nginx
25 26
26 Installation 27 Installation
27 ------------ 28 ------------
28 29
29 Left as an exercise. 30 Left as an exercise.
31
32 nginx configuration
33 -------------------
34
35 Here's nginx configuration snippet which use memcached to completely bypass Rails.
36
37 server {
38 server_name 0paste.com;
39 listen 80; listen [::]:80;
40 root /var/www/0paste.com/public;
41 error_page 445 = @zp;
42 error_page 404 /404.html;
43
44 if ($request_method = POST) {
45 return 445;
46 }
47
48 location / {
49 expires max;
50 try_files $uri @zp;
51 }
52
53 location ~ /(\d+(?:-\x+)?)(?:(\.txt)|\.html)?$ {
54 expires max;
55 charset utf-8;
56 set $memcached_key "zeropaste:pastes:$1$2";
57 memcached_pass localhost:11211;
58
59 default_type text/html;
60 error_page 404 502 = @zp;
61 }
62
63 location @zp {
64 proxy_pass http://localhost:9200;
65 proxy_set_header X-Forwarded-For $remote_addr;
66 proxy_set_header Host $host;
67 proxy_intercept_errors on;
68 }
69 }
30 70
31 Misc 71 Misc
32 ---- 72 ----
33 73
34 Pasting from CLI: 74 Pasting from CLI: