Apache Directives dissapears from vhost file

Discussion in 'Installation/Configuration' started by Kira, Oct 7, 2011.

  1. Kira

    Kira Member

    Hi,

    I have a realy strange problem with the ApacheDirectives..

    It's hard to describe, so I'll tell you what I do:


    1) I look at my Apache .vhost file:
    cat /etc/apache2/sites-enabled/myDomain.com.vhost


    This looks fine so far.

    2) I add this to the apache directives of my Site in ISPConfig3:

    Code:
    WSGIDaemonProcess myDaemon threads=15 maximum-requests=10000
    <Directory /var/www/myDomain.de/web>
      Options Indexes MultiViews FollowSymLinks ExecCGI
      AllowOverride All
    
      DirectoryIndex index.html index.py index.php
      AddHandler wsgi-script .py
    
      WSGIProcessGroup myDaemon
    
      Order allow,deny
      Allow from all
    </Directory>

    3) I look at the .vhosts file again to see the changes.. after a few seconds they appear and are correct.

    4) I go to my Website to load an Python file via WSGI.. and, I get to see the source code of my Python file..

    5) I look into the vhost file again and... somehow my changes disappeared. In step 3 they were there and correct, now they are gone again..

    In ISPConfig the Apache Directive Field still shows my changes, but they are not in the vhost file..


    I can do this as often as I want, as soon as I visit my website or restart apache manually (apache2ctl restart) the changes are gone...


    If I look into the "ISP Cron Log" there are some lines like this:
    But the name is 100% unique!

    Any idea what could be the problem?

    Thanks,
    Kira
     
    Last edited: Oct 7, 2011
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    one of the directives causes apache to fail so ispconfig has to remove it again as apache did not start. to find the resond, rename the vhost file to e.g. vhost.bak in the sites-available directory and then rename the vhost err file which you find in the same directory to the name of the original vhsot file and then restart apache to see the error message on the shell.
     
  3. Kira

    Kira Member

    Ah, okay.. the problem is, I am using SSL for this domain... and so my Apache Directives are placed twice in the vhost file..

    Because of this the following line is also duplicated:

    Code:
    WSGIDaemonProcess myDaemon threads=15 maximum-requests=10000
    And that's the problem...

    Is there anything I can do to fix this?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    If you want the apache directives only in the non ssl vhost, then you can e.g. Remove the apache directives placeholder from ssl part of the vhost master template.
     
  5. 00Kell

    00Kell New Member

    A way to individualise vhosts

    I realise this thread is a bit old but I am having pretty much the same problem in that I need unique entries for my SSL vhost.

    I haven't tried it yet but I am thinking that the following should allow me to create files that can be included in the vhost definitions to provide individualisation for http and https:


    In the vhost template:
    /usr/local/ispconfig/server/conf/vhost.conf.master

    At the end of the file, before or after <tmpl_var name='apache_directives'> (depends on which you would like to take priority).

    <tmpl_if name='ssl_enabled'>
    Include "<tmpl_var name='document_root'>/private/vhost_ssl[.conf]"
    </tmpl_else>
    Include "<tmpl_var name='document_root'>/private/vhost[.conf]"
    </tmpl_if>

    You can then put your config files in the private directory that ISPConfig 3.0.5 already creates . vhost.conf for http and vhost_ssl.conf for https.

    NB "[.conf]" is used in the Include so Apache will treat the file name as a global pattern which are allowed to match zero files without causing an error. Apache 2.4+ can use IncludeOptional instead.

    One advantage of this is that having an option for including directives as a file allows me to keep them under version control.

    So, can anyone think of a better solution, or one that is more in keeping with ISPConfig's design? Also, does vhost.conf.master get changed often?
     
    Last edited: Aug 31, 2014
  6. 00Kell

    00Kell New Member

    I encountered an issue with this when using vhost subdomains as they end up using the vhost files for the main domain. So here was my solution:

    Edit /usr/local/ispconfig/server/conf/vhost.conf.master as above except use:

    <tmpl_if name='ssl_enabled'>
    Include "<tmpl_var name='document_root'>/private/vhost_ssl_<tmpl_var name='domain'>[.conf]"
    </tmpl_else>
    Include "<tmpl_var name='document_root'>/private/vhost_<tmpl_var name='domain'>[.conf]"
    </tmpl_if>


    So instead of vhost.conf and vhost_ssl.conf in private/ you would need:

    vhost_domain.name.conf
    vhost_ssl_domain.name.conf

    where domain.name is the full name of the website or subdomain.
     

Share This Page