Best way to update vhost file

Discussion in 'General' started by Erik Damber, Jun 9, 2020.

  1. Erik Damber

    Erik Damber Member


    I'm looking for the best way to update a vhost file without ISPconfig overwriting the changes. This is what I try to insert.

    <IfModule mod_ssl.c>
    SSLEngine on
    SSLProxyEngine on
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    </IfModule mod_ssl.c>

    I get the vhost.err file when doing this and the file doesnt change. Anyway to get this to work with using ISPconfig interface or do I have to set it globally?

    dangkykinhdoanh likes this.
  2. Erik Damber

    Erik Damber Member

    This is what I see with journalctl -xe
    apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 115 of /etc/apache2/sites-enabled/ </IfModule without matching <IfModule section

    I can see that it already has a section with mod_ssl.c that contains SSLStaplingCache. Is that the problem?
  3. sascha92

    sascha92 New Member HowtoForge Supporter

    you can create your own vhost Template for ISPconfig

    Just copy the main apache_apps.vhost.master to the conf-custom dir
    cp /usr/local/ispconfig/server/conf/apache_apps.vhost.master /usr/local/ispconfig/server/conf-custom/apache_apps.vhost.master
    and change it the way you want it.

    If you don't want to set it for all new vhosts, you can edit your vhosts inside the web tab in your ISPconfig Webinterface
  4. Erik Damber

    Erik Damber Member

    This is regarding already existing websites, also want it to be created on the new ones I create later.

    I get the above error when I try to do it directly on a existing website. Not sure where to change it under server config. Apps Vhost Settings? Is these settings secure if I update ISPconfig later too?
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Or use Tools > resync to apply the changes to all sites. Just ensure to place the code inside the SSL section so that it gets only activated in the SSL vhost and not on port 80.
  6. Erik Damber

    Erik Damber Member

    Ok so the file linked above does not conatin mod_ssl.c. The one I found is this one

    Just edit that and resync?
  7. ahrasis

    ahrasis Well-Known Member

    I am sure you need to copy any master file to conf-custom before you edit the copied one, not the original.

    And sorry in advance, I am not sure so I am just going to ask this for clarification purpose, i.e. can't we just override the default in apache vhost like we may in nginx like you mentioned in here:
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Copy the file to /usr/local/ispconfig/server/conf-custom/ folder and then edit it there. Do not edit the file in the conf folder. Then do a resync.
    ahrasis likes this.
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no need for such an override in apache as apache always allows you to override the config by simply placing it at the end of the vhost, and that's what the apache directives field is doing. so if you want to have a config just for a single site, use the apache directives field instead of editing the master template. Regarding SSL settings, take care to wrap the settings into an apache if statement to ensure that they only get used by apache in the SSL vhost and not the non-ssl vhost.
    ahrasis likes this.
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    I refer to something like this (untested, syntax might be a bit different):

    <If "%{HTTPS} == 'on'">
        # your config here
    ahrasis likes this.
  11. Erik Damber

    Erik Damber Member

    Thanks for all the response, learned alot. Actually solved this by not including <ifmodule> and putting the statements directly into Options tab on website. Guess that is not update safe though? We are just testing on one website atm but later we need it on all.
    ahrasis likes this.
  12. Th0m

    Th0m ISPConfig Developer ISPConfig Developer

    If you want it on all, you can copy (as said before) the vhost.conf.master to the conf-custom folder and put it in there.
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    The options tab is update-safe of course.
    ahrasis likes this.
  14. Jesse Norell

    Jesse Norell ISPConfig Developer ISPConfig Developer

    Should be just </IfModule> I believe.
    Th0m likes this.

Share This Page