Skip to content

Custom Nginx Configurations

Danger

This page is aimed at advanced users. It is necessary to have knowledge about nginx to make custom configurations on the web server. Please note that an invalid configuration can result in making Tenantos unreachable.

Modifying the default nginx configuration files is not recommended, as any changes made will be lost during updates. Instead, if you need to add custom configurations, you should use the method described below.

To cover as many use cases and edge cases as possible, different approaches are offered for adding custom configurations to the vhosts:

  • Global includes for the frontend / additional brands
  • Global includes for agents
  • Includes on a per-domain basis

Each include is further divided into:

  • before_location (include before the location block)
  • in_root_location (include in the location block)
  • after_location (include after the location block)
  • HTTPS/HTTP (only for agents - the frontend is only reachable via HTTPS)

This may seem complicated, but it is easy to understand when looking at the configuration of the vhosts. The configuration files are located in the directory /etc/nginx/conf.d.

The vhost for agents is named agent.conf, while the main frontend domain is named master.conf. Brands are prefixed with brand_ followed by the domain name, for example, brand_app.example.org.conf.

Please note that if you want to make modifications to the local agent vhost, you must configure them on each agent if you want the changes to be applied to all agents. This means that if you make a configuration on your Tenantos main server for the local agent, it will not be automatically synchronized to the other agents. This is usually not desired, as this functionality is only used by advanced users and is intended for individual configurations.

The following tree output should help to understand the structure without looking into the vhost configurations:

├── agent.conf
├── brand_reseller-1.tenantos.com.conf
├── includes
│   ├── agent-global-includes
│   │   ├── http
│   │   │   ├── after_location
│   │   │   ├── before_location
│   │   │   └── in_root_location
│   │   └── https
│   │       ├── after_location
│   │       ├── before_location
│   │       └── in_root_location
│   ├── domains
│   │   ├── local-agent.tenantos.com
│   │   │   ├── http
│   │   │   │   ├── after_location
│   │   │   │   ├── before_location
│   │   │   │   └── in_root_location
│   │   │   └── https
│   │   │       ├── after_location
│   │   │       ├── before_location
│   │   │       └── in_root_location
│   │   ├── platform.tenantos.com
│   │   │   └── https
│   │   │       ├── after_location
│   │   │       ├── before_location
│   │   │       └── in_root_location
│   │   └── reseller-1.tenantos.com
│   │       └── https
│   │           ├── after_location
│   │           ├── before_location
│   │           └── in_root_location
│   ├── master-global-includes
│   │   └── https
│   │       ├── after_location
│   │       ├── before_location
│   │       └── in_root_location
├── master.conf