Permalink
Browse files

Adding in nginx configuration, del.icio.us configuration, and Thin se…

…ttings.
  • Loading branch information...
mikewest committed Nov 1, 2008
1 parent cf2115b commit d0c34aa266bd870b9c8da398859562472cbe02da
Showing with 107 additions and 3 deletions.
  1. +7 −3 Rakefile
  2. +9 −0 fallow.conf.example
  3. +91 −0 nginx.conf.example
View
@@ -6,6 +6,10 @@ ROOT_DIR = File.expand_path(File.dirname(__FILE__))
DATA_ROOT = ROOT_DIR + '/data'
ARTICLE_ROOT = DATA_ROOT + '/articles'
EXTERNALS_ROOT = DATA_ROOT + '/externals'
+
+THIN_INSTANCES = 3
+THIN_SOCKETS = '/tmp/thin.sock'
+
#
# Cache Tasks
#
@@ -87,12 +91,12 @@ EXTERNALS_ROOT = DATA_ROOT + '/externals'
desc 'Reset Thin server'
task :restart_thin => [:remove_logs] do
sh 'killall thin;'
- sh "thin start -R #{ROOT_DIR}/rackup.ru -s1 --socket /tmp/thin.sock;"
+ sh "thin start -R #{ROOT_DIR}/rackup.ru -s#{THIN_INSTANCES} --socket #{THIN_SOCKETS};"
end
desc 'Remove Thin logs'
task :remove_logs do
- sh 'rm ./log/thin.0.log;'
+ sh 'rm ./log/thin.*.log;'
end
task :rethin => [:restart_thin, :remove_logs]
@@ -102,7 +106,7 @@ EXTERNALS_ROOT = DATA_ROOT + '/externals'
#
desc 'Dump the log'
task :log do
- sh 'cat ./log/thin.0.log'
+ sh 'cat ./log/thin.*.log'
end
#
View
@@ -0,0 +1,9 @@
+##############################################################################
+# Fallow Configuration
+# ====================
+
+module Fallow
+ class Bookmarks
+ @@auth = [ 'your_del.icio.us_username', 'your_del.icio.us_password']
+ end
+end
View
@@ -0,0 +1,91 @@
+user www-data www-data;
+worker_processes 4;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+
+ sendfile on;
+ keepalive_timeout 65;
+
+ # These are (apparently) good default values.
+ tcp_nopush on;
+ tcp_nodelay off;
+
+ # output compression saves bandwidth
+ gzip on;
+ gzip_static on;
+ gzip_http_version 1.0;
+ gzip_comp_level 2;
+ gzip_proxied any;
+ gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/png;
+
+ include /usr/local/nginx/sites-enabled/*;
+}
+
+upstream example-com {
+ server unix:/tmp/thin.0.sock;
+}
+
+#
+# Who uses "www" anymore? No one, that's who.
+#
+server {
+ listen 80;
+ server_name www.example.com;
+ rewrite ^/(.*) http://example.com/$1 permanent;
+}
+
+#
+# Static server: max expiration, your own (much slower, and not edge-cached) akamai.
+#
+server {
+ listen 80;
+ server_name static.example.com;
+
+ root /home/user/public_html/example.com/public/static/;
+
+ location / {
+ if (-f $request_filename) {
+ expires max;
+ break;
+ }
+ }
+}
+
+#
+#
+#
+server {
+ listen 80;
+ server_name example.com;
+
+ access_log /home/user/public_html/example.com/log/access.log;
+ error_log /home/user/public_html/example.com/log/error.log;
+
+ root /home/user/public_html/example.com/public/;
+ index index.html;
+
+
+ location / {
+ rewrite ^/favicon.ico http://static.example.com/favicon.ico permanent;
+
+ if (-f $request_filename/index.html) {
+ rewrite (.*) $1/index.html break;
+ }
+
+ if (!-f $request_filename) {
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header Host $http_host;
+ proxy_redirect false;
+
+ proxy_pass http://example-com;
+ break;
+ }
+ }
+}

0 comments on commit d0c34aa

Please sign in to comment.