
13th July 2012, 12:49
|
|
Junior Member
|
|
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Choose listen port of a VirtualHost or overall apache listen port
I've realized that when a Server IP is added to ISPConfig, a list of listen ports can be choosen, and a NameVirtualHost IP:Port line is added to the apache config at sites-available/ispconfig.conf.
However there is no way to choose the listen port of apache server or of a site/virtualhost, only the IP can be choosen and to get listen in a different port is needed to change the default conf template at:
/usr/local/ispconfig/server/conf/vhost.conf.master
This is so weird, because in the template there is a "port" variable but I haven't found a way to change it in the ISPConfig panel.
It would be cool can choose a different port for each virtualhost, this is very usefull when a reverse proxy like varnish is used in a machine with dinamic and static content with only 1 IP. And seems that the internal logic is almost implemented in ISPConfig to get this.
Thank you,
Tomás
|

25th July 2012, 13:39
|
|
Member
|
|
Join Date: Mar 2009
Posts: 68
Thanks: 2
Thanked 14 Times in 9 Posts
|
|
Hello, I use reverse proxy too. Apache is listening on port 82. I added this port to System => IP Addresses. ISPConfig use this config only in sites-available/ispconfig.conf when defining NameVirtualhosts.
So I looked at plugins, specific /usr/local/ispconfig/server/plugins-availableapache2_plugin.inc.php and I found that ports are hard coded in this file. So I edit hardcoded ports 80 to 82 and resync sites. Its on 4 places together. If I update ispconfig I must edit this file again.
Will be better, if this plugin get right ports from db instead of hardcode it.
Last edited by tio289; 25th July 2012 at 13:42.
|

25th July 2012, 13:41
|
|
Member
|
|
Join Date: Mar 2009
Posts: 68
Thanks: 2
Thanked 14 Times in 9 Posts
|
|
Quote:
Originally Posted by Estopero
...to get listen in a different port is needed to change the default conf template at:
/usr/local/ispconfig/server/conf/vhost.conf.master
|
this is bad solution, because this template is for SSL vhosts too, so if you hardcode port for non-ssl vhosts, ssl vhost created by ispconfig will use same port = fail.
|

25th July 2012, 14:14
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,872
Thanks: 689
Thanked 4,186 Times in 3,203 Posts
|
|
Quote:
|
this is bad solution, because this template is for SSL vhosts too, so if you hardcode port for non-ssl vhosts, ssl vhost created by ispconfig will use same port = fail.
|
You are wrong as you can select between ssl and non ssl hosts in the template. Check the if conditions.
|

25th July 2012, 14:29
|
|
Member
|
|
Join Date: Mar 2009
Posts: 68
Thanks: 2
Thanked 14 Times in 9 Posts
|
|
I have this in vhosts.conf
Code:
<tmpl_loop name="vhosts">
<VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name='port'}>
so ip and port is given from var, and if site has ssl on, loop has 2 entries. So if he hardcode port to this
Code:
<tmpl_loop name="vhosts">
<VirtualHost {tmpl_var name='ip_address'}:82>
ssl will be same port as non-ssl.
in the past version of ispconfig, was in vhost.conf two virtualhosts. One for non-ssl and one fo ssl. Now, as we can see, is there loop.
|

25th July 2012, 14:42
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,872
Thanks: 689
Thanked 4,186 Times in 3,203 Posts
|
|
Your configuration is wrong. As you can see in the template,all ssl specfic instructions are wrapped in a if stetement, so you can select between ssl and non ssl easily. The correct configuration is:
Code:
<tmpl_loop name="vhosts">
<tmpl_if name='ssl_enabled'>
<VirtualHost {tmpl_var name='ip_address'}:81>
<tmpl_else>
<VirtualHost {tmpl_var name='ip_address'}:82>
</tmpl_if>
|

25th July 2012, 14:44
|
|
Member
|
|
Join Date: Mar 2009
Posts: 68
Thanks: 2
Thanked 14 Times in 9 Posts
|
|
I have latest ispconfig and I doesnt change anything in this file.
|

25th July 2012, 15:09
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,872
Thanks: 689
Thanked 4,186 Times in 3,203 Posts
|
|
If you want to use customports, then you have to configure them in the vhost file like I explained above and like it is explained in other threads here in the forum as well. If you dont configure your custom ports, then it wont work of course
|

28th August 2012, 13:32
|
|
Junior Member
|
|
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by till
If you want to use customports, then you have to configure them in the vhost file like I explained above and like it is explained in other threads here in the forum as well. If you dont configure your custom ports, then it wont work of course 
|
Till, my master template looks also like tio289. But I did the change that you said and it worked for ssl/non-ssl sites thanks  , now is something like this (I needed to re-save the vhosts):
Quote:
<tmpl_loop name="vhosts">
<tmpl_if name='ssl_enabled'>
<VirtualHost {tmpl_var name='ip_address'}:443>
<tmpl_else>
<VirtualHost {tmpl_var name='ip_address'}:81>
</tmpl_if>
|
However, really to implement a custom port by vhost in the Control Panel is a too hard task?
I think that modify templates should be an "exception" action, what happens with that templates when ispconfig is upgraded? Would be needed to re-apply the changes to the templates? Also exists the problem with choose a different port/IP for different vhosts (maybe only some vhosts run with a reverse-proxy and not all of them)
I understand that you may have other priorities but don't forget this please =)
Thanks
Last edited by Estopero; 28th August 2012 at 13:35.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 10:49.
|
|
Recent comments
2 days 1 hour ago
2 days 10 hours ago
2 days 13 hours ago
2 days 14 hours ago
2 days 16 hours ago
2 days 17 hours ago
2 days 19 hours ago
2 days 20 hours ago
3 days 12 hours ago
3 days 13 hours ago