Skip to content

Instantly share code, notes, and snippets.

@wenzhixin
Created May 8, 2015 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wenzhixin/042f8997d029b25ddea1 to your computer and use it in GitHub Desktop.
Save wenzhixin/042f8997d029b25ddea1 to your computer and use it in GitHub Desktop.
running nginx, puma & redmine from sub-uri
####### NGINX
nginx config for running redmine under /redmine
(assuming working nginx config)
+++ add
upstream redmine-puma {
server unix:/<<redminepath>>/tmp/sockets/redmine.sock fail_timeout=0;
}
+++ add
location /redmine {
alias /<<redminepath>>/public/;
try_files $uri/index.html $uri.html $uri @puma;
}
+++ add
location @puma {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_read_timeout 300;
proxy_pass http://redmine-puma;
}
####### PUMA
puma config in <<redminepath>>/config/puma.rb
#!/usr/bin/env puma
# start puma with:
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb
application_path = '<<redminepath>>'
directory application_path
environment 'production'
daemonize true
pidfile "#{application_path}/tmp/pids/puma.pid"
state_path "#{application_path}/tmp/pids/puma.state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
bind "unix://#{application_path}/tmp/sockets/redmine.sock"
####### REDMINE
redmine config in <<redminepath>>/config/application.rb
+++ add
config.asset_path = "/redmine%s"
redmine config in <<redminepath>>/config/environment.rb
+++ add
RedmineApp::Application.routes.default_scope = '/redmine'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment