Addition to server/plugins-available/apache2_plugin.inc.php

Discussion in 'Developers' Forum' started by Riaan, May 20, 2017.

  1. Riaan

    Riaan New Member

    Hi there,
    Not sure if this is the right location to post this, but here goes anyway.

    I need an additional variable for directory snippet for apache. I host MONO websites via mod_mono with ISPConfig and have to manually add the directive for every site that uses it. The directive looks like this:

    DocumentRoot {DOCROOT_CLIENT}
    MonoServerPath domain.com /usr/bin/mod-mono-server4
    MonoDebug domain.com true
    MonoSetEnv domain.com MONO_IOMAP=all
    MonoApplications domain.com "/:{DOCROOT_CLIENT}"
    <Location "/">
    Allow from all
    Order allow,deny
    MonoSetServerAlias domain.com
    SetHandler mono
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
    </Location>
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
    </IfModule>

    Then I'd need to go and change the domain.com in the 5 positions in the snipped once selected for a domain. This is irritating, to say the least. If only I had a variable {DOMAIN} I could use.

    Well, it so happens that when you look at server/plugins-available/apache2_plugin.inc.php at line 1143 it looks like this:
    $trans = array(
    '{DOCROOT}' => $vhost_data['web_document_root_www'],
    '{DOCROOT_CLIENT}' => $vhost_data['web_document_root']
    );

    Changing this to:
    $trans = array(
    '{DOCROOT}' => $vhost_data['web_document_root_www'],
    '{DOCROOT_CLIENT}' => $vhost_data['web_document_root'],
    '{DOMAIN}' => $vhost_data['domain']
    );

    Solves my problem 100%. I can now have the directory snippet like below and it works perfectly.

    DocumentRoot {DOCROOT_CLIENT}
    MonoServerPath {DOMAIN} /usr/bin/mod-mono-server4
    MonoDebug {DOMAIN} true
    MonoSetEnv {DOMAIN} MONO_IOMAP=all
    MonoApplications {DOMAIN} "/:{DOCROOT_CLIENT}"
    <Location "/">
    Allow from all
    Order allow,deny
    MonoSetServerAlias {DOMAIN}
    SetHandler mono
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
    </Location>
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
    </IfModule>

    Could we maybe add this to future updates?
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    It works .. the best place is the bug tracker though; a quick search finds there is an issue for this, with code to implement (not in a merge request though, which probably slows it's adoption): https://git.ispconfig.org/ispconfig/ispconfig3/issues/3375
     
    Gwyneth Llewelyn likes this.

Share This Page