en
Language
  • en
  • cs
  • hu
  • it
  • es
  • fr
  • de
  • ru

URL Prefix (sub-uri) server configuration (deprecated from version 11)

Deprecation from version 11

Due to compatibility issues with the latest front-end components, running Easy Project on sub-uri is no longer suported in version 11.

Introduction

In most cases, Easy Project is run on a subdomain (e.g. https://application.mycompany.com). This is the most stable way.

However, due to internal policies, some companies run it on a sub-uri (e.g. https://mycompany.com/application). If this is your case, you need to be extra careful about the server configuration. Here are our tips for correct functioning.

Using incorrect configuration may result in problems with some functions. Most notably: Exports, Javascript components like Gantt or WBS, modal windows and others.

The sample configuration is for application https://prefix.easyproject.com/application

Setup puma

For puma you need to edit 2 files - config.ru and config/environment.rb

config.ru -> add map for "/application" around current run application
map  '/application' do
  run RedmineApp::Application
end
config/puma.rb -> set RAILS_RELATIVE_URL_ROOT env variable
RAILS_ENV = ENV['RAILS_ENV']
ENV['RAILS_RELATIVE_URL_ROOT'] = '/application'

workers 2
threads 1, 2

preload_app!

rackup      DefaultRackup
environment RAILS_ENV || 'production'
plugin "tmp_restart"

worker_timeout 600

APP_HOME = File.join(File.absolute_path(File.dirname(__FILE__)), "../")

directory File.join(APP_HOME, 'public_html')
bind "unix://#{APP_HOME}/application.sock"
pidfile File.join(APP_HOME, 'application.pid')

stdout_redirect File.join(APP_HOME, 'public_html/log/puma.log'), File.join(APP_HOME, 'public_html/log/puma.err')

on_worker_boot do
  ActiveRecord::Base.establish_connection
end
Nginx

Update root, add location for "/application" and create aliases. Example:

upstream xxx.easyproject.com {
  server                      unix:///home/easyproject/xxx.easyproject.com/application.sock;
}

server {

  listen                      443 ssl http2;
  server_name                 xxx.easyproject.com;
#  root                        /home/easyproject/xxx.easyproject.com/public_html/public;
  root                        /home/easyproject/xxx.easyproject.com/application;



  access_log                  /var/log/nginx/xxx.easyproject.com.log;
  error_log                   /var/log/nginx/xxx.easyproject.com.err;


location /application {
#    root                        /home/easyproject/xxx.easyproject.com/public_html/public;
    alias                        /home/easyproject/xxx.easyproject.com/application;
    proxy_pass                http://xxx.easyproject.com;
    include default.d/upstream.conf;
  }

  location /cable {
    proxy_pass                http://xxx.easyproject.com;
    include default.d/websocket.conf;
  }

location ~ ^/application/(images|system|assets|plugin_assets)/ {
    alias                        /home/easyproject/xxx.easyproject.com/application;
    proxy_pass                http://xxx.easyproject.com;

    gzip_static               on;
    expires                   3M;
    add_header                Cache-Control public;
    add_header                ETag '';
    break;
}

  ssl_certificate             /etc/nginx/ssl/xxx.crt;
  ssl_certificate_key         /etc/nginx/ssl/xxx.key;

}

Apache2

    <Directory /path/to/application/>                
            RailsBaseURI /application
            PassengerResolveSymlinksInDocumentRoot on
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

Don't forget!

In the application settings, enter the full URL.

Admin >> Settings >> General - Host name and path

Try Easy Project in 30 days free trial

Full features, SSL protected, daily backups, in your geolocation