Soooo... This is, how to do it:
You need the following Script, the location doesn't matter... Currently it is not very advanced but it longs to run ispconfig with lighttpd:
//////// BEGIN /root/ispconfig/custom/lighttpd.conf.php
Code:
#!/usr/bin/php -q
<?
$go_info["server"]["db_host"] = "localhost";
$go_info["server"]["db_name"] = "db_ispconfig";
$go_info["server"]["db_user"] = "root";
$go_info["server"]["db_password"] = "12345";
$go_info["server"]["db_type"] = "mysql";
mysql_pconnect($go_info["server"]["db_host"],$go_info["server"]["db_user"],$go_info["server"]["db_password"]);
mysql_select_db($go_info["server"]["db_name"]);
list($shost,$sdomain,$docroot,$user,$group,$log,$sname)=mysql_fetch_array(mysql_query("select server_host,server_domain,server_path_httpd_root,server_httpd_user,server_httpd_group,server_path_httpd_log,dist_httpd_daemon from isp_server limit 1"));
if($shost)$sdomain="$shost.$sdomain";
echo "server.name=\"$sdomain\"\n";
echo "server.tag=\"ispconfig/lighttpd@$sdomain\"\n";
echo "server.username=\"$user\"\n";
echo "server.groupname=\"$group\"\n";
echo "server.document-root=\"$docroot/sharedip\"\n";
echo "accesslog.filename=\"$log\"\n";
$db_res=mysql_query("select doc_id,web_host,web_domain,web_cgi,optionen_directory_index from isp_isp_web");
$yr=date("Y");
$mn=date("m");
echo "\n\n########## VHOSTS ########\n\n";
/* I should assign the additional domains from isp_isp_domain here as well,
but right now I don't know how they are assigned... ;-) */
while(list($id,$host,$domain,$cgi,$dirindex)=mysql_fetch_array($db_res))
{
$vhlist[$domain]=array("id"=>$id,"dirlist"=>true,"cgi"=>$cgi);
if($host) $vhlist["$host.$domain"]=array("id"=>$id,"dirlist"=>true,"cgi"=>$cgi);
}
reset($vhlist);
while(list($host,$parm)=each($vhlist))
{
echo "\$HTTP[\"host\"]==\"$host\" {\n";
echo "\tserver.name=\"$host\"\n";
echo "\tserver.document-root=\"$docroot/web$parm[id]/web\"\n";
echo "\t#accesslog.filename=\"/var/log/lighttpd/web$parm[id]-access.log\"\n";
echo "\taccesslog.filename=\"$docroot/web$parm[id]/log/$yr/$mn/web.log\"\n";
echo "\tserver.dir-listing=\"".(($parm["dirlist"])?"enable":"disable")."\"\n";
if($parm["cgi"]) echo "\tcgi.assign=(\n\t\t\".pl\"=>\"/usr/bin/perl\",\n\t\t\".py\"=>\"/usr/bin/python\",\n\t)\n";
echo "}\n\n";
}
?>
//////// END /root/ispconfig/custom/lighttpd.conf.php
You can run it directly and see it's output - these are standard lighttpd configuration directives. Now create a corresponding lighttpd configuration:
//////// BEGIN /etc/lighttpd/lighttpd.conf
Code:
############## Module Prefs ################
server.modules=("mod_access","mod_cgi","mod_accesslog","mod_fastcgi")
############### Generic Preferences #############
server.errorlog="/var/log/lighttpd/error.log"
server.pid-file="/var/run/lighttpd.pid"
#accesslog.filename="/var/log/lighttpd/access.log"
index-file.names=("index.html","index.htm")
url.access-deny=("~",".inc")
server.event-handler="linux-sysepoll"
#You can set this to port 9999 to run lighttpd besides apache2
#server.port=9999
server.port=80
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
############# Basic Dirlist-Settings ################
server.dir-listing="enable"
dir-listing.encoding="iso-8859-15"
dir-listing.hide-dotfiles="enable"
#dir-listing.external-css="/dir.css"
############# PHP-Fastcgi-Stuff ################
index-file.names+=("index.php")
fastcgi.server=(
".php"=>(
"localhost"=>(
"bin-path"=>"/usr/bin/php5-cgi",
"socket"=>"/tmp/php5-socket",
"max-procs"=>2,
"bin-environment"=>(
"PHP_FCGI_CHILDREN"=>"1",
"PHP_FCGI_MAX_REQUESTS"=>"10000",
),
"bin-copy-environment"=>(
"PATH",
"SHELL",
"USER",
),
"broken-scriptfilename"=>"enable"
)
)
)
############# And now, our VHOST-Handling ################
include_shell "/root/ispconfig/custom/lighttpd.conf.php"
//////// END /etc/lighttpd/lighttpd.conf
This expects debian/ubuntu style lighttpd-package, where there is a mime-script at /usr/share/lighttpd/create-mime.assign.pl ... you can comment the line and put the mime-handling from the example-config in it if you don't want this.
Maybe you have to adapt the fastcgi-configuration to your needs, for example if your php-cgi fastcgi enabled binary is not at /usr/bin/php5-cgi ... Also, this is my lightweight configuration example (only a few fcgi-processes)
You can create the entire lighttpd-config this way from MySQL-Informations, they will refresh every time you reload lighty... So it is quite easy to switch from apache2 to lighty without making major changes to existing apache2-configs...
As you can see, while I don't know much about ISPCONFIG-Internals, my script is poorly using it's features, I guess you can make one much better in five minutes or so ;-)
Have Fun!
Martin