Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Feature Requests

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 13th July 2012, 13:49
Estopero Estopero is offline
Junior Member
 
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
Sponsored Links
  #2  
Old 25th July 2012, 14:39
tio289 tio289 is offline
Member
 
Join Date: Mar 2009
Posts: 70
Thanks: 2
Thanked 14 Times in 9 Posts
Default

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.
__________________
Independent Senior Webdeveloper

Last edited by tio289; 25th July 2012 at 14:42.
Reply With Quote
  #3  
Old 25th July 2012, 14:41
tio289 tio289 is offline
Member
 
Join Date: Mar 2009
Posts: 70
Thanks: 2
Thanked 14 Times in 9 Posts
Default

Quote:
Originally Posted by Estopero View Post
...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.
__________________
Independent Senior Webdeveloper
Reply With Quote
  #4  
Old 25th July 2012, 15:14
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,036
Thanks: 841
Thanked 5,655 Times in 4,464 Posts
Default

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.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 25th July 2012, 15:29
tio289 tio289 is offline
Member
 
Join Date: Mar 2009
Posts: 70
Thanks: 2
Thanked 14 Times in 9 Posts
Default

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.
__________________
Independent Senior Webdeveloper
Reply With Quote
  #6  
Old 25th July 2012, 15:42
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,036
Thanks: 841
Thanked 5,655 Times in 4,464 Posts
Default

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>
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #7  
Old 25th July 2012, 15:44
tio289 tio289 is offline
Member
 
Join Date: Mar 2009
Posts: 70
Thanks: 2
Thanked 14 Times in 9 Posts
Default

I have latest ispconfig and I doesnt change anything in this file.
__________________
Independent Senior Webdeveloper
Reply With Quote
  #8  
Old 25th July 2012, 16:09
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 37,036
Thanks: 841
Thanked 5,655 Times in 4,464 Posts
Default

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 Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #9  
Old 28th August 2012, 14:32
Estopero Estopero is offline
Junior Member
 
Join Date: Mar 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by till View Post
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 14:35.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sessions not being saved gavimobile General 6 15th January 2012 16:05
server doesn't listen on UDP port 53 kmchen Installation/Configuration 3 10th January 2012 18:13
How To Configure PureFTPd To Accept TLS Sessions On Debian Squeeze GarGamel55 HOWTO-Related Questions 11 6th August 2011 12:45
URGENT PLEASE: 3rd Time Installing and Still Have SMTP Issues with PostFix norby Server Operation 9 24th June 2011 14:58
New domains not added to Bind9 DNS DKLeader Installation/Configuration 15 15th January 2011 22:11


All times are GMT +2. The time now is 07:53.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.