# http://www.redmine.org/wiki/redmine/HowTo_configure_Nginx_to_run_Redmine # http://wiki.rubyonrails.org/deployment/nginx-thin # http://blog.khax.net/2010/04/01/nginx-mongrel-redmine-quick-setup-notes/ # Upstream Ruby process cluster for load balancing upstream thin_cluster { server unix:/tmp/thin.redmine.0.sock; server unix:/tmp/thin.redmine.1.sock; server unix:/tmp/thin.redmine.2.sock; server unix:/tmp/thin.redmine.3.sock; } server { listen 80; server_name projects.whyaskwhy.org; # access_log /var/log/nginx/redmine-proxy-access; # error_log /var/log/nginx/redmine-proxy-error; # DEBUGGING # rewrite_log on; # access_log /var/log/nginx/testing.access.log vhost_combined_debugging; # error_log /var/log/nginx/testing.error.log debug; include proxy.inc.conf; root /var/www/whyaskwhy.org/projects; proxy_redirect off; # Send sensitive stuff via https rewrite ^/redmine/login(.*) https://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/my/account(.*) https://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/my/password(.*) https://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/admin(.*) https://projects.whyaskwhy.org$request_uri permanent; location /redmine { alias /opt/redmine/public/; try_files $uri/index.html $uri.html $uri @cluster; } location @cluster { proxy_pass http://thin_cluster; } } server { listen 443; server_name projects.whyaskwhy.org; # access_log /var/log/nginx/redmine-ssl-proxy-access; # error_log /var/log/nginx/redmine-ssl-proxy-error; include ssl.inc.conf; include proxy.inc.conf; proxy_redirect off; root /var/www/whyaskwhy.org/projects; # When we're back to non-sensitive things, send back to http rewrite ^/redmine/$ http://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/projects(.*) http://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/guide(.*) http://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/users(.*) http://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/my/page(.*) http://projects.whyaskwhy.org$request_uri permanent; rewrite ^/redmine/logout(.*) http://projects.whyaskwhy.org$request_uri permanent; location /redmine { alias /opt/redmine/public/; try_files $uri/index.html $uri.html $uri @cluster; } location @cluster { proxy_pass http://thin_cluster; } }