User Rating: 4 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Inactive

If you have ever tried to run your sites through a proxy or Varnish with ISPConfig3 you have probably encountered the problem that whenever you make a change to your site settings through ISPConfig3 web gui, the default port 80 will be written to your vhost file, overwriting any custom port you have there. The solution to this is, according to the developers in their forum, to make a change in:



where you change the line:

<VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name='port'}>


<VirtualHost {tmpl_var name='ip_address'}:8000>

That solution works if you don't have SSL enabled for the site. If you do have SSL enabled the SSL vhost conf, which contains port 443, will also be overwritten with port 8000 so SSL will stop working. This is a workaround:

Start with copying: /usr/local/ispconfig/server/conf/vhost.conf.master to /usr/local/ispconfig/server/conf-custom/vhost.conf.master so you don't have to make this change again after updating ISPConfig3. Then edit these lines:

<VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name='port'}>

to this:

<tmpl_if name='port' op='==' value='80'><VirtualHost {tmpl_var name='ip_address'}:8000></tmpl_else>
<tmpl_if name='port' op='==' value='443'>
<VirtualHost {tmpl_var name='ip_address'}:443><tmpl_if></tmpl_if>

This has been tested on Ubuntu 12.04 and ISPConfig but probably works on other setups as well.