Apache-SdnFw

 view release on metacpan or  search on metacpan

lib/Apache/SdnFw/bin/conf.pl  view on Meta::CPAN

#
print 'ServerType standalone';
my $user = ($ENV{HTTPD_USER}) ? $ENV{HTTPD_USER} : 'apache';
my $group = ($ENV{HTTPD_GROUP}) ? $ENV{HTTPD_GROUP} : 'users';
print 'User '.$user;
print 'Group '.$group;
    
print 'MinSpareServers '.$ENV{APACHE_MIN_SERVERS} || '5';
print 'MaxSpareServers '.$ENV{APACHE_MAX_SERVERS} || '5';
print 'StartServers '.$ENV{APACHE_START_SERVERS} || '8';
print 'MaxClients '.$ENV{APACHE_MAX_CLIENTS} || '20';
print 'MaxRequestsPerChild '.$ENV{APACHE_MAX_REQUESTS} || '100';

print 'ServerAdmin "root"';

#
# pid/ directory
#
die "No log directory at $ENV{HTTPD_ROOT}/logs."
    unless -e "$ENV{HTTPD_ROOT}/logs";
print 'PidFile "logs/httpd.pid"';
print 'ScoreBoardFile "logs/httpd.scoreboard"';

print <<END;
ServerName "$ENV{SERVER_NAME}"
Listen $ENV{IP_ADDR}:$ENV{HTTP_PORT}
END

unless($ENV{NO_HTTPS}) {
	print <<END;
Listen $ENV{IP_ADDR}:$ENV{HTTPS_PORT}
END
}

print <<END;

ExtendedStatus On
KeepAlive Off
UseCanonicalName Off
TypesConfig /etc/mime.types
DefaultType text/plain
HostnameLookups Off
LogLevel warn
ErrorLog "logs/error_log"
LogFormat "\%h \%l \%u \%t \\"%r\\" \%>s \%b" common
LogFormat "\%h \%l \%u \%t \\"\%r\\" \%>s \%b \\"\%{Referer}i\\" \\"\%{User-Agent}i\\"" combined
CustomLog "logs/access_log" combined
LogFormat "\%h \%{LOCATION_ID}e \%{USER_ID}e \%t \\"\%r\\" \%>s \%b \\"\%{Referer}i\\" \\"\%{User-Agent}i\\" \\"\%{SID}e\\" \\"\%{DOMAIN_NAME}e\\" \\"\%{POST_DATA}e\\"" sdnfw

ServerSignature Off

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0

AddType application/x-httpd-php .php

#SSLSessionCache dbm:/var/cache/httpd/ssl_cache
#SSLSessionCacheTimeout 300

#ProxyRequests Off

END

if ($ENV{PRELOAD_SDNFW}) {
	print <<END;

PerlRequire /code/sdnfw/startup.pl

END
}

#
# Virtual Hosts
#
print <<END;
<Location /server-status>
    SetHandler server-status
</Location>
END

if ($ENV{XML_STATUS}) {
print <<END;

<Location /server-status-xml>
	SetHandler server-status-xml
</Location>
END
}

print <<END;

NameVirtualHost $ENV{IP_ADDR}:$ENV{HTTP_PORT}
END

unless($ENV{NO_HTTPS}) {
	print <<END;
NameVirtualHost $ENV{IP_ADDR}:$ENV{HTTPS_PORT}
END
}


#
# Other projects as needed.
#
my $dir;
opendir $dir, "$ENV{HTTPD_ROOT}";
if ($ENV{LOAD}) {
	foreach my $d (split ' ', $ENV{LOAD}) {
		next if $d =~ m/^\./;
		next if $d eq 'conf';
		next unless -e "$ENV{HTTPD_ROOT}/$d/conf.pl";

		#print STDERR "Running $d/conf.pl" if ($ENV{HTTPD_DEV} || $ENV{HTTPD_LOCAL});
		require "$ENV{HTTPD_ROOT}/$d/conf.pl";
	}
} else {
	foreach my $d (readdir $dir) {
		next if $d =~ m/^\./;



( run in 2.095 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )