Custom vhost

Discussion in 'Installation/Configuration' started by olimortimer, Nov 12, 2014.

  1. olimortimer

    olimortimer Member

    Is there any way through the ISPConfig control panel to add extra lines to the vhost files?

    I noticed in a sites-enabled vhost that there's a line that states '# PHPIniDir /var/www/conf/webX', so I was wondering if ISPConfig is set to pick up custom ini files and insert them into the vhost?

    What I would like to do, is add in a custom php_value, to allow me to monitor each site as a different application through New Relic;

    Code:
    php_value newrelic.appname "name of site"
    In a perfect world, I'd like any new sites to automatically add this, with the "name of the site" being the URL of the site.
     
  2. cbj4074

    cbj4074 Member

    One can add custom lines to the vhost file using the Options tab when editing the Website in question.

    The bottom field on this tab is "Apache Directives" (or "nginx Directives" if using NGINX). Any directives that are pasted into this field will be saved to the appropriate vhost configuration file. The only exception to this is if the lines cause a syntax error; in such cases, ISPConfig is smart enough to discard the change and save the "broken" configuration to *.vhost.err (where * is the vhost name). This is hugely helpful because you can compare the working vhost configuration file to the broken file and determine what you may have done incorrectly.

    With regard to adding the desired configuration directive(s) automatically when a new website is created, I don't think it's possible -- at least not without modifying the relevant ISPConfig template. Such edits are discouraged because they would be overwritten when upgrading ISPConfig, causing your site to stop functioning correctly (or at all).

    Albeit more work, it's much safer to add this line to each website as you create it.

    If you really must be able to achieve this, then I suggest you setup a working copy of the ISPCode with SVN (see: http://code.openhub.net/project?pid=&ipid=302891 ) and create a version-controlled solution that enables you to override ISPConfig's default templates and then create your own upgrade packages manually. As far as I'm aware, this is the only way to ensure that ISPConfig upgrades don't break your customizations.
     
    Last edited: Nov 13, 2014
  3. olimortimer

    olimortimer Member

    Excellent, thank you cbj4074!
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    The link you posted contains a really old ispconfig version, we switched to git some time ago. If you like to get current code, then please download it from the official git server:

    http://git.ispconfig.org/explore

    All templates can be easily and update safe customized in ispconfig since versipn 3.0.4. Just store the modified themplates in the conf-custom flder and the modified installer templates in conf-custom/install/

    Only if you would modify the sourcecode (.php files) then you should make a fork on our git server to get a version controlled copy for your changes.
     
    Last edited: Nov 13, 2014

Share This Page