No upcoming meetings 17 Feb 2020

URL Prefix (sub-uri) server configuration

Author: Easy Admin Displayed: 1100
Created: 27 Feb 2019 Updated: 27 Feb 2019
Version: 1
Tags:
MoreLess

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/environment.rb -> append this line to end of file
Redmine::Utils::relative_url_root = "/application"

Nginx

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

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

server {

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



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


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

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

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

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

  ssl_certificate             /etc/nginx/ssl/easyproject_com.crt;
  ssl_certificate_key         /etc/nginx/ssl/easyproject_com.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

Image20190227160546_1.png

Add picture from clipboard