Pacific-Design.com

    
Home Index

1. Linux

2. Apache2

Linux / Apache2 /

vi /etc/httpd/conf/httpd.conf

# ps aux | grep 'httpd' | awk '{print $6/1024 " MB";}'
<IfModule prefork.c>
    StartServers      32
    MinSpareServers   16
    MaxSpareServers   16
    ServerLimit      512
    MaxClients        64
    MaxRequestsPerChild  10000
</IfModule>

PerlModule CGI 
PerlModule DBI

Enable mod_rewrite in a Ubuntu server

1. Instruct Apache to load the mod_rewrite module.
2. Edit the document root entry so that the rewrite engine is allowed.
3. Create an .htaccess file to rewrite urls for you.

Command line

a2enmod rewrite
service apache2 restart

Reference: http://www.ghacks.net/2009/12/05/enable-mod_rewrite-in-a-ubuntu-server/

Restart Apache2 If Stopped

#!/bin/bash #---------------------------------------------------------------------------------------------# if netcat pacific-design.com 80 <<EOF | awk 'NR==1{if ($2 == "500") exit 0; exit 1;}'; then GET / HTTP/1.1 Host: pacific-design.com EOF apache2ctl restart; fi #---------------------------------------------------------------------------------------------#

Display Environment Variables

#!/usr/bin/perl #-------------------------------------------------------# # FastCGI display environment variables #-------------------------------------------------------# use FCGI; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); $| = 1; #-------------------------------------------------------# my $request = FCGI::Request(); my $counter = 0; while($request->Accept() >= 0) { $counter ++; print "Content-Type: text/html\n\n"; print "<h3>Fast CGI works $counter ...</h3>\n"; print "<tt>\n"; foreach $key (sort keys(%ENV)) { print "<b>$key</b> = $ENV{$key}<br>\n"; } my $kevin = param('q'); print "<h1>parameter " . $kevin . "</h1>"; print "<h1>END</h1>"; } #-------------------------------------------------------#