Apache VHost Templates

The Apache configuration a new virtual host is made from

Your own virtual host template

A virtual host template is the Apache configuration Opensolr writes when it makes a project's virtual host. Each project can have its own; until it does, the default for its project type is used.

Where: Projects › click a project › Edit VHost Template

01 · When the template is used

Only when the project is created and when you click Create VHost. Nothing else writes a virtual host from it: Setup SSL edits the file already on the server and leaves the rest of it as it is. To change the live virtual host now, use Edit VHost on the project.

02 · Edit it

  1. Click Edit VHost Template. The top line shows the hostname, the type and Using Default Template or Using Custom Template.
  2. Change the configuration. It must keep {{ hostname }} and {{ document_root }}.
  3. Click Save Template. The project now uses its own template.
  4. To apply it, click Create VHost. This replaces the current virtual host: every manual change in it is lost, and the dialog says so before it goes ahead.

03 · Variables

VariableFilled with
{{ hostname }}The project's hostname.
{{ server_alias }}The server aliases, separated by spaces; empty when there are none.
{{ document_root }}The folder Apache publishes. See Auto-detection.
{{ php_version }}The PHP version of the server.
{{ site_name }}The project name.
{{ log_name }}The name of the site's log files.
{{ ssl_certificate }}The certificate file.
{{ ssl_certificate_key }}The private key file.
{{ ssl_certificate_chain }}The chain file, when there is one.
{{ fpm_socket }}The PHP socket of a dedicated pool; empty when the site uses the server-wide pool.

Templates use the Jinja2 syntax, so blocks such as {% if server_alias %} work. The template belongs to the project name, so it stays when you change the hostname.

04 · Safety and reset

  • Before a new virtual host goes live, Apache checks it. If the check fails, the previous file is put back and you see the error.
  • Reset to Default deletes your custom template; the project goes back to the default of its type.

Projects tab