Koozali.org formerly Contribs.org

Strange error in my httpd.conf file thrown on the console

Strange error in my httpd.conf file thrown on the console
« on: September 18, 2018, 03:51:42 AM »
I'm getting an error reported on my console with my httpd.conf.  It's an "invalid if statement" at line 544.  When I check 544, I see this:

if ( $port eq "80" && $virtualHost eq "support.bru.com")

    # For redirection to support.bru.com.
    Redirect / http://support.bru.com/


    # skipping SSL directives

    ...
Should that be in the httpd.conf, or in the iBay configuration?
« Last Edit: September 18, 2018, 03:56:45 AM by tolistim »

Re: Strange error in my httpd.conf file thrown on the console
« Reply #1 on: September 18, 2018, 06:26:15 AM »
Here's my custom template for 25SSLDirectives in VirtualHosts:
if ( $port eq "80" && $virtualHost eq "support.bru.com")
   {
       $OUT .= "    \n";
       $OUT .= "    # For redirection to support.bru.com.\n";
       $OUT .= "    Redirect / http://support.bru.com/\n";
   }

{
    return "    # skipping SSL directives\n" unless $port eq "443";

    return "" unless $modSSL{'status'} eq 'enabled';

    $OUT =  <<SSL_END;
    # SSL Directives
    SSLEngine on
SSL_END
}


However, that's not what is getting written into the httpd.conf file.

Offline Daniel B.

  • *
  • 1,690
    • Firewall Services, la sécurité des réseaux
Re: Strange error in my httpd.conf file thrown on the console
« Reply #2 on: September 18, 2018, 07:42:39 AM »
You need to enclose the if section in {}. Only stuff inside {} is evaluated as Perl code
C'est la fin du monde !!! :lol:

Re: Strange error in my httpd.conf file thrown on the console
« Reply #3 on: September 18, 2018, 01:43:00 PM »
Hi tolistim,

Daniel B. is right.


Code: [Select]
{
    if ( $port eq "80" && $virtualHost eq "support.bru.com")
    {
       $OUT .= "    \n";
       $OUT .= "    # For redirection to support.bru.com.\n";
       $OUT .= "    Redirect / http://support.bru.com/\n";
    }

    return "    # skipping SSL directives\n" unless $port eq "443";
   
    return "" unless $modSSL{'status'} eq 'enabled';

    $OUT =  <<SSL_END;
    # SSL Directives
    SSLEngine on
SSL_END

}

Michel-André