Koozali.org formerly Contribs.org

Contribs.org Forums => SME Server 9.x => Topic started by: tolistim on September 18, 2018, 03:51:42 AM

Title: Strange error in my httpd.conf file thrown on the console
Post by: tolistim 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/ (http://support.bru.com/)


    # skipping SSL directives

    ...
Should that be in the httpd.conf, or in the iBay configuration?
Title: Re: Strange error in my httpd.conf file thrown on the console
Post by: tolistim 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.
Title: Re: Strange error in my httpd.conf file thrown on the console
Post by: Daniel B. on September 18, 2018, 07:42:39 AM
You need to enclose the if section in {}. Only stuff inside {} is evaluated as Perl code
Title: Re: Strange error in my httpd.conf file thrown on the console
Post by: michelandre 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é