Created
May 8, 2015 03:44
-
-
Save wenzhixin/042f8997d029b25ddea1 to your computer and use it in GitHub Desktop.
running nginx, puma & redmine from sub-uri
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
####### 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