Creating Websites that Use Non-Standard Ports

Discussion in 'Installation/Configuration' started by fatbear, Apr 29, 2012.

  1. fatbear

    fatbear Member HowtoForge Supporter

    I want Apache to listen on non-standard ports. Instead of 80 and 443 for http and https, I want it to listen on 10080 and 10443. In the control panel, I went to:
    System > Server IP addresses > [click on server name]
    And, then I changed the HTTP Ports from 80,443 to 10080,10443.

    When I create a new website "" by doing:
    Sites > Add new website > IPv4-Address > [the above IP address]
    I find that the domain configuration file:
    has in it:
    not the 10080 that I would have expected.

    By the way, the reason I want this is because I'm running the Pound load balancer and reverse proxy because I'm also running Tomcat and other software on this server and it takes care of redirecting URLs on ports 80 and 443 to the appropriate backend application code. Note, this is also useful because in various corporate environments non-standard ports are blocked on web pages, so I need something like Pound to take care of the traffic redirection.

    What did I do wrong? What do I need to do to get ISPConfig to use the ports that I've specified for that IP address? Is this a bug?
  2. fatbear

    fatbear Member HowtoForge Supporter

    Some checking reveals that the file:

    /usr/local/ispconfig/server/plugins-enabled/ has (lines 1014-1029):
    //* Add vhost for ipv4 IP       
    if(count($rewrite_rules) > 0){
        $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80, 'redirects' => $rewrite_rules);
    } else {
        $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80);
    //* Add vhost for ipv4 IP with SSL
    if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
        if(count($rewrite_rules) > 0){
            $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443', 'redirects' => $rewrite_rules);
        } else {
            $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443');
        $app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
    Note that the port is hardcoded above (scroll to the right) to being set to 80 or 443:
    'port' => '80'
    'port' => '443'
    I'll look at updating this code to use the values that are specified in the control panel and submit it to the codebase.
  3. letic

    letic New Member

    Hey fatbear,

    I was trying to do the same today (Apache running on 81 with nginx proxy on port 80).and encountered the same issue.

    The settings in Server -> IP addresses does update /etc/apache2/sites-available/ispconfig.conf with the correct NameVirtualHost (for those interested the code is in /usr/local/ispconfig/server/plugins-available/ in
    function server_ip($event_name,$data)
    But the vhost file is not updated as it is hardcoded (as you shown). Did you have time to make a patch for this ? How do you decide which port has SSL enabled or not ?

    Thanks in advance.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

  5. letic

    letic New Member

    Hey till,

    I know you can change the template but what happens in a multi-server environment ? Do you change the template only on the slave that have the specific configuration ?

    It would still be nice to be able to use the port defined in the settings.

  6. till

    till Super Moderator Staff Member ISPConfig Developer

    A template is used on the server where it is located. So if you have slaves with different configurations, then change the template only on that slaves where the different configuration shall be applied.

Share This Page