From 484fbdd48c26f7cc482e3defb9d7d11a4d58a982 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Sat, 10 Jul 2010 15:43:04 +1000 Subject: [PATCH] Setup nginx config for crucial virtual machine --- etc/nginx.conf | 305 ++++++++++++++++--------------------------------- 1 file changed, 97 insertions(+), 208 deletions(-) diff --git a/etc/nginx.conf b/etc/nginx.conf index 92b72d4..5cc3112 100644 --- a/etc/nginx.conf +++ b/etc/nginx.conf @@ -1,214 +1,103 @@ +server { + listen 80; + server_name new.wezm.net; + root /home/wezm/www; -#user nobody; -worker_processes 1; + location / { + index index.html index.xml; + } -#error_log logs/error.log; -#error_log logs/error.log notice; -#error_log logs/error.log info; + # deny access to draft posts + location ~ ^/drafts/ { + deny all; + } -#pid logs/nginx.pid; + # Rewrites + rewrite ^/qr$ / permanent; + # Date based entries + rewrite "^/(?:\d+/)+(?:page/\d+/)?$" / permanent; -events { - worker_connections 1024; -} - - -http { - include mime.types; - default_type application/octet-stream; - - #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' - # '$status $body_bytes_sent "$http_referer" ' - # '"$http_user_agent" "$http_x_forwarded_for"'; - - #access_log logs/access.log main; - - sendfile on; - #tcp_nopush on; - - #keepalive_timeout 0; - keepalive_timeout 65; - - gzip on; - gzip_types text/xml; - - server { - listen 80; - server_name localhost; - - #charset koi8-r; - - #access_log logs/host.access.log main; - - location / { - root share/nginx/html; - index index.html index.htm; - } - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root share/nginx/html; - } - - # proxy the PHP scripts to Apache listening on 127.0.0.1:80 - # - #location ~ \.php$ { - # proxy_pass http://127.0.0.1; - #} - - # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 - # - #location ~ \.php$ { - # root share/nginx/html; - # fastcgi_pass 127.0.0.1:9000; - # fastcgi_index index.php; - # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; - # include fastcgi_params; - #} - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - # - #location ~ /\.ht { - # deny all; - #} - } - - - # another virtual host using mix of IP-, name-, and port-based configuration - # - server { - listen 80; - server_name wezm.local; - - location / { - root /Users/wmoore/Sites/wezm.net/output; - index index.html index.xml; - } - - # deny access to draft posts - location ~ ^/drafts/ { - deny all; - } - - # Rewrites - rewrite ^/qr$ / permanent; - - # Date based entries - rewrite "^/(?:\d+/)+(?:page/\d+/)?$" / permanent; - - rewrite ^/archives/$ /articles/ permanent; - - # Categories - rewrite ^/category/(personal|entertainment|miscellaneous|out-and-about)/ /personal/articles/ permanent; - rewrite ^/category/(technical|apple|code|development|internet|linux|programming|projects|software|tips|unix|windows)/ /technical/articles/ permanent; - rewrite ^/category/ /articles/ permanent; - - # Home page, pagination - rewrite ^/page/\d+/ / permanent; - - # Tags - rewrite ^/tag/ /articles/ permanent; - - # Images - #http://www.wezm.net/wp-content/uploads/wezm.net/2009/08/MG_7215.jpg - rewrite "^/wp-content/uploads/(?:wezm.net/)?(\d{4}/\d{2}/.*)$" /images/$1 permanent; - - # Rewite old permalinks - rewrite ^/2008/02/seeking-app-ideas/$ /technical/2008/02/seeking-app-ideas/ permanent; - rewrite ^/2008/03/windows-silverlight-installation-experience/$ /technical/2008/03/windows-silverlight-installation-experience/ permanent; - rewrite ^/2008/03/webkit-for-keynote/$ /technical/2008/03/webkit-for-keynote/ permanent; - rewrite ^/2008/03/create-empty-tar-file/$ /technical/2008/03/create-empty-tar-file/ permanent; - rewrite ^/2008/04/pizza-style-delivery-for-technical-books/$ /technical/2008/04/pizza-style-delivery-for-technical-books/ permanent; - rewrite ^/2008/04/womens-weekly-getting-in-on-the-linux-action/$ /technical/2008/04/womens-weekly-getting-in-on-the-linux-action/ permanent; - rewrite ^/2008/04/mp3-decoder-libraries-compared/$ /technical/2008/04/mp3-decoder-libraries-compared/ permanent; - rewrite ^/2008/04/expand-glob-in-variable-within-shell-script/$ /technical/2008/04/expand-glob-in-variable-within-shell-script/ permanent; - rewrite ^/2008/05/death-to-the-feed-uri-scheme/$ /technical/2008/05/death-to-the-feed-uri-scheme/ permanent; - rewrite ^/2008/05/geohashing/$ /personal/2008/05/geohashing/ permanent; - rewrite ^/2008/05/stop-vim-completion-searching-included-files/$ /technical/2008/05/stop-vim-completion-searching-included-files/ permanent; - rewrite ^/2008/05/to-title-case-bookmarklet/$ /technical/2008/05/to-title-case-bookmarklet/ permanent; - rewrite ^/2008/07/comment-feeds-in-wordpress/$ /technical/2008/07/comment-feeds-in-wordpress/ permanent; - rewrite ^/2008/07/iphone-vodafone-comments/$ /technical/2008/07/iphone-vodafone-comments/ permanent; - rewrite ^/2008/07/iphone-tips-from-the-user-guide/$ /technical/2008/07/iphone-tips-from-the-user-guide/ permanent; - rewrite ^/2008/07/iphone-3g-one-week-in/$ /personal/2008/07/iphone-3g-one-week-in/ permanent; - rewrite ^/2008/08/pondering-sent-from-my-iphone/$ /technical/2008/08/pondering-sent-from-my-iphone/ permanent; - rewrite ^/2008/08/iphone-gripe-trucated-song-titles/$ /technical/2008/08/iphone-gripe-trucated-song-titles/ permanent; - rewrite ^/2008/09/update-expectations/$ /technical/2008/09/update-expectations/ permanent; - rewrite ^/2008/09/zsh-cygwin-and-insecure-directories/$ /technical/2008/09/zsh-cygwin-and-insecure-directories/ permanent; - rewrite ^/2008/09/pimping-vim-on-windows/$ /technical/2008/09/pimping-vim-on-windows/ permanent; - rewrite ^/2008/09/new-theme/$ /personal/2008/09/new-theme/ permanent; - rewrite ^/2008/11/cumquat-liqueur/$ /personal/2008/11/cumquat-liqueur/ permanent; - rewrite ^/2008/11/typography-enhancements/$ /personal/2008/11/typography-enhancements/ permanent; - rewrite ^/2008/11/power-mac-g5-on-ebay/$ /technical/2008/11/power-mac-g5-on-ebay/ permanent; - rewrite ^/2008/11/movember/$ /personal/2008/11/movember/ permanent; - rewrite ^/2008/11/progress-update/$ /technical/2008/11/progress-update/ permanent; - rewrite ^/2008/11/iphone-case/$ /technical/2008/11/iphone-case/ permanent; - rewrite ^/2009/01/the-iphone-headphones-have-a-button/$ /technical/2009/01/the-iphone-headphones-have-a-button/ permanent; - rewrite ^/2009/01/sensation-melbourne-nye/$ /personal/2009/01/sensation-melbourne-nye/ permanent; - rewrite ^/2009/01/determining-non-automatically-installed-debian-packages/$ /technical/2009/01/determining-non-automatically-installed-debian-packages/ permanent; - rewrite ^/2009/03/once-a-month-cooking/$ /personal/2009/03/once-a-month-cooking/ permanent; - rewrite ^/2009/03/debian-lenny-released/$ /technical/2009/03/debian-lenny-released/ permanent; - rewrite ^/2009/03/my-first-new-site-is-live/$ /technical/2009/03/my-first-new-site-is-live/ permanent; - rewrite ^/2009/03/install-consolas-mac-osx/$ /technical/2009/03/install-consolas-mac-osx/ permanent; - rewrite ^/2009/03/mac-remote-desktop-connection-without-installer/$ /technical/2009/03/mac-remote-desktop-connection-without-installer/ permanent; - rewrite ^/2009/03/becoming-a-melbourne-cyclist/$ /personal/2009/03/becoming-a-melbourne-cyclist/ permanent; - rewrite ^/2009/03/moving-geeky-posts-to-binary-trance/$ /personal/2009/03/moving-geeky-posts-to-binary-trance/ permanent; - rewrite ^/2009/03/general-tech-content-here-from-now-on/$ /personal/2009/03/general-tech-content-here-from-now-on/ permanent; - rewrite ^/2009/03/gmail-stickers-have-arrived/$ /personal/2009/03/gmail-stickers-have-arrived/ permanent; - rewrite ^/2009/03/free-virtualisation-with-virtualbox/$ /technical/2009/03/free-virtualisation-with-virtualbox/ permanent; - rewrite ^/2009/03/mlug-virtualbox-workshop/$ /uncategorized/2009/03/mlug-virtualbox-workshop/ permanent; - rewrite ^/2009/03/consolas-on-mac-update/$ /technical/2009/03/consolas-on-mac-update/ permanent; - rewrite ^/2009/03/bash-git-completion-with-mac-ports/$ /technical/2009/03/bash-git-completion-with-mac-ports/ permanent; - rewrite ^/2009/04/greetings-from-tall-karri-country/$ /personal/2009/04/greetings-from-tall-karri-country/ permanent; - rewrite ^/2009/04/capturing-an-rtmp-video-stream-with-flv-recorder/$ /technical/2009/04/capturing-an-rtmp-video-stream-with-flv-recorder/ permanent; - rewrite ^/2009/05/exclude-directories-from-textmate-side-bar-for-faster-find-in-project/$ /technical/2009/05/exclude-directories-from-textmate-side-bar-for-faster-find-in-project/ permanent; - rewrite ^/2009/05/spider-a-site-with-wget-using-sitemap-xml/$ /technical/2009/05/spider-a-site-with-wget-using-sitemap-xml/ permanent; - rewrite ^/2009/05/rafael-bonachelas-360-degrees/$ /personal/2009/05/rafael-bonachelas-360-degrees/ permanent; - rewrite ^/2009/06/virtualbox-news-atom-feed/$ /technical/2009/06/virtualbox-news-atom-feed/ permanent; - rewrite ^/2009/06/programming-fonts-recap/$ /technical/2009/06/programming-fonts-recap/ permanent; - rewrite ^/2009/07/scraping-nab-internet-banking-with-mechanize/$ /technical/2009/07/scraping-nab-internet-banking-with-mechanize/ permanent; - rewrite ^/2009/08/temperature-logger-project/$ /technical/2009/08/temperature-logger-project/ permanent; - rewrite ^/2009/08/local-package-management-with-gnu-stow/$ /technical/2009/08/local-package-management-with-gnu-stow/ permanent; - rewrite ^/2009/08/adaptive-shell-idea/$ /technical/2009/08/adaptive-shell-idea/ permanent; - rewrite ^/2009/08/the-art-of-backup/$ /technical/2009/08/the-art-of-backup/ permanent; - rewrite ^/2009/09/font-smoothing-in-snow-leopard/$ /technical/2009/09/font-smoothing-in-snow-leopard/ permanent; - rewrite ^/2010/01/updated-applications/$ /technical/2010/01/updated-applications/ permanent; - rewrite ^/2010/01/sensation-melbourne-2009/$ /personal/2010/01/sensation-melbourne-2009/ permanent; - rewrite ^/2010/01/mt-dandenong/$ /personal/2010/01/mt-dandenong/ permanent; - rewrite ^/2010/01/clone-git-repo-on-non-standard-port/$ /technical/2010/01/clone-git-repo-on-non-standard-port/ permanent; - rewrite ^/2010/02/ipad-and-the-future-of-computing/$ /technical/2010/02/ipad-and-the-future-of-computing/ permanent; - rewrite ^/2010/02/git-object-store-efficiency/$ /technical/2010/02/git-object-store-efficiency/ permanent; - rewrite ^/2010/03/installing-debian-with-gpxe-and-netboot-me/$ /technical/2010/03/installing-debian-with-gpxe-and-netboot-me/ permanent; - - - } - - - # HTTPS server - # - #server { - # listen 443; - # server_name localhost; - - # ssl on; - # ssl_certificate cert.pem; - # ssl_certificate_key cert.key; - - # ssl_session_timeout 5m; - - # ssl_protocols SSLv2 SSLv3 TLSv1; - # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; - # ssl_prefer_server_ciphers on; - - # location / { - # root share/nginx/html; - # index index.html index.htm; - # } - #} - + rewrite ^/archives/$ /articles/ permanent; + + # Categories + rewrite ^/category/(personal|entertainment|miscellaneous|out-and-about)/ /personal/articles/ permanent; + rewrite ^/category/(technical|apple|code|development|internet|linux|programming|projects|software|tips|unix|windows)/ /technical/articles/ permanent; + rewrite ^/category/ /articles/ permanent; + + # Home page, pagination + rewrite ^/page/\d+/ / permanent; + + # Tags + rewrite ^/tag/ /articles/ permanent; + + # Images + #http://www.wezm.net/wp-content/uploads/wezm.net/2009/08/MG_7215.jpg + rewrite "^/wp-content/uploads/(?:wezm.net/)?(\d{4}/\d{2}/.*)$" /images/$1 permanent; + + # Rewite old permalinks + rewrite ^/2008/02/seeking-app-ideas/$ /technical/2008/02/seeking-app-ideas/ permanent; + rewrite ^/2008/03/windows-silverlight-installation-experience/$ /technical/2008/03/windows-silverlight-installation-experience/ permanent; + rewrite ^/2008/03/webkit-for-keynote/$ /technical/2008/03/webkit-for-keynote/ permanent; + rewrite ^/2008/03/create-empty-tar-file/$ /technical/2008/03/create-empty-tar-file/ permanent; + rewrite ^/2008/04/pizza-style-delivery-for-technical-books/$ /technical/2008/04/pizza-style-delivery-for-technical-books/ permanent; + rewrite ^/2008/04/womens-weekly-getting-in-on-the-linux-action/$ /technical/2008/04/womens-weekly-getting-in-on-the-linux-action/ permanent; + rewrite ^/2008/04/mp3-decoder-libraries-compared/$ /technical/2008/04/mp3-decoder-libraries-compared/ permanent; + rewrite ^/2008/04/expand-glob-in-variable-within-shell-script/$ /technical/2008/04/expand-glob-in-variable-within-shell-script/ permanent; + rewrite ^/2008/05/death-to-the-feed-uri-scheme/$ /technical/2008/05/death-to-the-feed-uri-scheme/ permanent; + rewrite ^/2008/05/geohashing/$ /personal/2008/05/geohashing/ permanent; + rewrite ^/2008/05/stop-vim-completion-searching-included-files/$ /technical/2008/05/stop-vim-completion-searching-included-files/ permanent; + rewrite ^/2008/05/to-title-case-bookmarklet/$ /technical/2008/05/to-title-case-bookmarklet/ permanent; + rewrite ^/2008/07/comment-feeds-in-wordpress/$ /technical/2008/07/comment-feeds-in-wordpress/ permanent; + rewrite ^/2008/07/iphone-vodafone-comments/$ /technical/2008/07/iphone-vodafone-comments/ permanent; + rewrite ^/2008/07/iphone-tips-from-the-user-guide/$ /technical/2008/07/iphone-tips-from-the-user-guide/ permanent; + rewrite ^/2008/07/iphone-3g-one-week-in/$ /personal/2008/07/iphone-3g-one-week-in/ permanent; + rewrite ^/2008/08/pondering-sent-from-my-iphone/$ /technical/2008/08/pondering-sent-from-my-iphone/ permanent; + rewrite ^/2008/08/iphone-gripe-trucated-song-titles/$ /technical/2008/08/iphone-gripe-trucated-song-titles/ permanent; + rewrite ^/2008/09/update-expectations/$ /technical/2008/09/update-expectations/ permanent; + rewrite ^/2008/09/zsh-cygwin-and-insecure-directories/$ /technical/2008/09/zsh-cygwin-and-insecure-directories/ permanent; + rewrite ^/2008/09/pimping-vim-on-windows/$ /technical/2008/09/pimping-vim-on-windows/ permanent; + rewrite ^/2008/09/new-theme/$ /personal/2008/09/new-theme/ permanent; + rewrite ^/2008/11/cumquat-liqueur/$ /personal/2008/11/cumquat-liqueur/ permanent; + rewrite ^/2008/11/typography-enhancements/$ /personal/2008/11/typography-enhancements/ permanent; + rewrite ^/2008/11/power-mac-g5-on-ebay/$ /technical/2008/11/power-mac-g5-on-ebay/ permanent; + rewrite ^/2008/11/movember/$ /personal/2008/11/movember/ permanent; + rewrite ^/2008/11/progress-update/$ /technical/2008/11/progress-update/ permanent; + rewrite ^/2008/11/iphone-case/$ /technical/2008/11/iphone-case/ permanent; + rewrite ^/2009/01/the-iphone-headphones-have-a-button/$ /technical/2009/01/the-iphone-headphones-have-a-button/ permanent; + rewrite ^/2009/01/sensation-melbourne-nye/$ /personal/2009/01/sensation-melbourne-nye/ permanent; + rewrite ^/2009/01/determining-non-automatically-installed-debian-packages/$ /technical/2009/01/determining-non-automatically-installed-debian-packages/ permanent; + rewrite ^/2009/03/once-a-month-cooking/$ /personal/2009/03/once-a-month-cooking/ permanent; + rewrite ^/2009/03/debian-lenny-released/$ /technical/2009/03/debian-lenny-released/ permanent; + rewrite ^/2009/03/my-first-new-site-is-live/$ /technical/2009/03/my-first-new-site-is-live/ permanent; + rewrite ^/2009/03/install-consolas-mac-osx/$ /technical/2009/03/install-consolas-mac-osx/ permanent; + rewrite ^/2009/03/mac-remote-desktop-connection-without-installer/$ /technical/2009/03/mac-remote-desktop-connection-without-installer/ permanent; + rewrite ^/2009/03/becoming-a-melbourne-cyclist/$ /personal/2009/03/becoming-a-melbourne-cyclist/ permanent; + rewrite ^/2009/03/moving-geeky-posts-to-binary-trance/$ /personal/2009/03/moving-geeky-posts-to-binary-trance/ permanent; + rewrite ^/2009/03/general-tech-content-here-from-now-on/$ /personal/2009/03/general-tech-content-here-from-now-on/ permanent; + rewrite ^/2009/03/gmail-stickers-have-arrived/$ /personal/2009/03/gmail-stickers-have-arrived/ permanent; + rewrite ^/2009/03/free-virtualisation-with-virtualbox/$ /technical/2009/03/free-virtualisation-with-virtualbox/ permanent; + rewrite ^/2009/03/mlug-virtualbox-workshop/$ /uncategorized/2009/03/mlug-virtualbox-workshop/ permanent; + rewrite ^/2009/03/consolas-on-mac-update/$ /technical/2009/03/consolas-on-mac-update/ permanent; + rewrite ^/2009/03/bash-git-completion-with-mac-ports/$ /technical/2009/03/bash-git-completion-with-mac-ports/ permanent; + rewrite ^/2009/04/greetings-from-tall-karri-country/$ /personal/2009/04/greetings-from-tall-karri-country/ permanent; + rewrite ^/2009/04/capturing-an-rtmp-video-stream-with-flv-recorder/$ /technical/2009/04/capturing-an-rtmp-video-stream-with-flv-recorder/ permanent; + rewrite ^/2009/05/exclude-directories-from-textmate-side-bar-for-faster-find-in-project/$ /technical/2009/05/exclude-directories-from-textmate-side-bar-for-faster-find-in-project/ permanent; + rewrite ^/2009/05/spider-a-site-with-wget-using-sitemap-xml/$ /technical/2009/05/spider-a-site-with-wget-using-sitemap-xml/ permanent; + rewrite ^/2009/05/rafael-bonachelas-360-degrees/$ /personal/2009/05/rafael-bonachelas-360-degrees/ permanent; + rewrite ^/2009/06/virtualbox-news-atom-feed/$ /technical/2009/06/virtualbox-news-atom-feed/ permanent; + rewrite ^/2009/06/programming-fonts-recap/$ /technical/2009/06/programming-fonts-recap/ permanent; + rewrite ^/2009/07/scraping-nab-internet-banking-with-mechanize/$ /technical/2009/07/scraping-nab-internet-banking-with-mechanize/ permanent; + rewrite ^/2009/08/temperature-logger-project/$ /technical/2009/08/temperature-logger-project/ permanent; + rewrite ^/2009/08/local-package-management-with-gnu-stow/$ /technical/2009/08/local-package-management-with-gnu-stow/ permanent; + rewrite ^/2009/08/adaptive-shell-idea/$ /technical/2009/08/adaptive-shell-idea/ permanent; + rewrite ^/2009/08/the-art-of-backup/$ /technical/2009/08/the-art-of-backup/ permanent; + rewrite ^/2009/09/font-smoothing-in-snow-leopard/$ /technical/2009/09/font-smoothing-in-snow-leopard/ permanent; + rewrite ^/2010/01/updated-applications/$ /technical/2010/01/updated-applications/ permanent; + rewrite ^/2010/01/sensation-melbourne-2009/$ /personal/2010/01/sensation-melbourne-2009/ permanent; + rewrite ^/2010/01/mt-dandenong/$ /personal/2010/01/mt-dandenong/ permanent; + rewrite ^/2010/01/clone-git-repo-on-non-standard-port/$ /technical/2010/01/clone-git-repo-on-non-standard-port/ permanent; + rewrite ^/2010/02/ipad-and-the-future-of-computing/$ /technical/2010/02/ipad-and-the-future-of-computing/ permanent; + rewrite ^/2010/02/git-object-store-efficiency/$ /technical/2010/02/git-object-store-efficiency/ permanent; + rewrite ^/2010/03/installing-debian-with-gpxe-and-netboot-me/$ /technical/2010/03/installing-debian-with-gpxe-and-netboot-me/ permanent; }