[Solved] Custom vhost config syntax

Discussion in 'ISPConfig 3 Priority Support' started by remkoh, Nov 27, 2025.

  1. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    I've been using custom vhost config for apache and nginx in ispconfig since forever.
    Mostly to enhance scoring on internet.nl by altering ssl ciphers, adding custom config/snippets and adding ssl stapling.
    The last one is where I now stumble.
    LE abandoned ocsp a while ago and because of that I now get several warning in nginx about it and I want to clear that.
    I'm trying to alter the custom vhost config to ONLY add ssl stapling when ssl is enabled and LE is NOT enabled.

    I've tried
    Code:
    <tmpl_if name='ssl_enabled'>
    <tmpl_if name='ssl_letsencrypt' op='!=' value='y'>
    .....
    </tmpl_if>
    </tmpl_if>
    
    but it seems like ispconfig doesn't recognize that, as tasks are stuck in the queue and I get an error in the cron log.
    Code:
    PHP Parse error:  Unmatched &#039;}&#039; in /usr/local/ispconfig/server/lib/classes/tpl.inc.php(1344) : eval()&#039;d code on line 91
    
    So what is the correct syntax to accomplish what I want?
     
    ahrasis likes this.
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    It seems like ssl_letsencrypt is not set by ISPConfig to be a template option, and also there is none used in default to be a sample, that is why I think you got that error, no match as there is no such option available for us to use. Since vhost config, default or custom, are meant for all web sites, and you want to enable it only for certain site(s) that need SSL with stapling, try using nginx directives to add the same to such site(s). This is just a work around that I can think of for now, and there could be other ways, also you can ask / propose for it to be added to ISPConfig, in the future, if none really existed already as I assumed above.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    All fields of the web_domain table should be available by default, so its ok to use that variable. Even if you would use a variable that does not exist, it would not throw this error. But there must be a syntax error in your template.
     
    remkoh likes this.
  4. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Oh yes, on that note @till I think I can see that he might need to use == instead of just = there. May be.
     
  5. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    Only thing changed is above code added in a before that working template.

    The line is a straight up copy of another line in the same template. Only the name is changed.
     
  6. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    So back to no code exist to support that?
     
  7. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    Already tried. Makes no difference.
    Strange enough does it work flawlessly on another nginx node.
    Even though the template isn't exactly the same, added lines are.

    Btw, left this out as I was already inside such if
    Code:
    <tmpl_if name='ssl_enabled'>
    .....
    </tmpl_if>
    
    Though that too made no difference on the problematic node.

    I think I'm going to redo the custom template from the latest template out of ispc 3.3.0p3.
     
    Last edited: Nov 27, 2025
  8. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    So it works on other nginx node except this one, good to know, since it must not be that line, but the whole custom vhost.

    Why you don't you simply copy it (the whole custom vhost) from that node directly, if it really works on that node?
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    That's what I meant, your issue was not in the code you posted, there is another syntax error somewhere else in your template.
     
  10. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    I must have made a typo by accident somewhere else that I can't find.
    It was working just fine until this edit.

    Because it's an older node that has been updated from 20.04 to 22.04 and fairly recent to 24.04.
    The custom template on that one is based on the original from several ispc versions ago, where the problem node is a 24.04 and ispc 3.2.x (now running 3.3.0p3, as are all other nodes) install.
     
  11. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Have a chance to try that today and it seems working fine on my ISPConfig nginx server.
    Code:
    <tmpl_if name='ssl_enabled'>
    <tmpl_if name='ssl_letsencrypt' op='!=' value='y'>
    </tmpl_if>
    </tmpl_if>
    May the developers can add this 'ssl_letsencrypt' line empty in the default vhost so others may know it is available and and use it if they need to? Or may be not. Just a thought anyway.
     
  12. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    I already stated in post #7 that it works on other nodes. So the code is just fine.
    I must have screwed up another line by accident on the problem node. Only I can't find it :oops:
     
  13. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Noted, that you did mention it before and again, after you were not so sure yourself by the OP, but it is all resolved then, so I was merely stating the obvious to you in the above reply, but may not be that obvious to others, so I think my confirmation may be a good addition to yours, for others.

    Also, personally I would normally just take the default and add / re add my customization to check, in case of such a break happened, but these days I don't need that much customization any way, except for quic and http3 testing on my ISPConfig lab server.
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    We will not add any unused config to the template.
     
  15. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    Redone the whole custom template from the latest original.
    Corrected some anomalies that exist in the original and added my own custom config again.
    Also did a full cleanup so everthing in the vhost file is nicely tabbed now instead of mixed up tabs and spaces which made the vhost file a mess.
    Everything is working now :D
     
    Last edited: Nov 29, 2025
  16. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    Though I do have another question.
    Is it posible to do a file existance check in the template?
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

    No. But if you refer to Nginx, you can let Nginx do that by using * wildcard in an include path, there will be no failure if the file is not there.
     
  18. remkoh

    remkoh Well-Known Member HowtoForge Supporter

    Was already afraid that would be the answer :(
    I know but that's not an option for my use case.
     

Share This Page