I am only familiar with deploying a rails application at the root url. Running in a subdirectory really just messes with everything.
Routes, assets, and javascript really breaks.
Application Side of the House
config.ru
# This file is used by Rack-based servers to start the application.
require_relative 'config/environment'
run Rack::URLMap.new('/commandcenter' => Rails.application)
config/environments/production.rb
Rails.application.configure do
config.relative_url_root = "/commandcenter"
host = 'localhost:3000'
if !ENV['HOST'].nil?
host = ENV['HOST']
end
config.action_controller.asset_host = host
config.action_mailer.default_url_options = { :host => "https://commandcenter.ourcompose.com" }
if !ENV['HOST'].nil?
config.action_mailer.default_url_options = { :host => ENV['HOST'] }
end
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => Rails.application.credentials.smtp[:url],
:port => Rails.application.credentials.smtp[:port],
:user_name => Rails.application.credentials.smtp[:user],
:password => Rails.application.credentials.smtp[:password],
:authentication => :plain,
enable_starttls_auto: true
}
end
NGINX Side
location /commandcenter/ {
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 64;
proxy_set_header Host $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;
add_header Front-End-Https on;
proxy_pass http://commandcenter/commandcenter/;
}