#!/usr/bin/php ServerName www.$domain_name ServerAlias $domain_name *.$domain_name VirtualDocumentRoot $domain_home_dir/%2+/%1 ErrorLog /var/log/httpd/$domain_name-error.log CustomLog /var/log/httpd/$domain_name-access.log combined # ScriptAlias /cgi-bin/ $domain_home_dir/$domain_name/cgi-bin/ Options -Indexes Includes ExecCGI FollowSymLinks allowoverride all allow from all Options -Indexes Includes ExecCGI FollowSymLinks allowoverride all allow from all "; $host_named_config='$TTL 14400 @ IN SOA '.$name_server1.'. root.'.$domain_name.'. ( '.time().' ; Serial 14400 3600 1209600 86400 ) @ 14400 IN NS '.$name_server1.'. @ 14400 IN NS '.$name_server2.'. @ 14400 IN A '.$ip_address.' ftp 14400 IN A '.$ip_address.' localhost 14400 IN A 127.0.0.1 mail 14400 IN A '.$ip_address.' www 14400 IN A '.$ip_address.' * 14400 IN A '.$ip_address.' @ 14400 IN MX 10 mail ns1 14400 IN A '.$ip_address.' ns2 14400 IN A '.$ip_address.' '; $webalizer_config_file="LogFile /var/log/httpd/$domain_name-access.log OutputDir $domain_home_dir/$domain_name/stat HistoryName webalizer.hist Incremental yes IncrementalName webalizer.current HostName $domain_name PageType htm* PageType cgi PageType php PageType shtml PageType php3 PageType pl DNSCache /var/lib/webalizer/dns_cache.db DNSChildren 10 Quiet yes FoldSeqErr yes HideURL *.gif HideURL *.GIF HideURL *.jpg HideURL *.JPG HideURL *.png HideURL *.PNG HideURL *.ra SearchEngine yahoo.com p= SearchEngine altavista.com q= SearchEngine google.com q= SearchEngine eureka.com q= SearchEngine lycos.com query= SearchEngine hotbot.com MT= SearchEngine msn.com MT= SearchEngine infoseek.com qt= SearchEngine webcrawler searchText= SearchEngine excite search= SearchEngine netscape.com search= SearchEngine mamma.com query= SearchEngine alltheweb.com query= SearchEngine northernlight.com qr= "; if(file_exists($named_zone_dir."/".$domain_name)){ print "Domain exists. Skip.\n"; exit; } //create zone file $OpenZoneFiles=fopen($named_zone_dir."/".$domain_name, "w"); fwrite($OpenZoneFiles, $host_named_config); fclose($OpenZoneFiles); $OpenNamedConf=fopen($named_conf, "a"); fwrite($OpenNamedConf, "zone \"$domain_name\" { type master; file \"$named_zone_dir/$domain_name\"; };\n"); fclose($OpenNamedConf); //create webalizer config file $WabAConf=fopen($webalizer_config_dir."/".$domain_name.".conf", "w"); fwrite($WabAConf,$webalizer_config_file); fclose($WabAConf); //create http host file $OpenHostFiles=fopen($apache_conf_dir."/".$domain_name.".conf", "w"); fwrite($OpenHostFiles, $host_httpd_config); fclose($OpenHostFiles); //create directory system("mkdir -p $domain_home_dir/$domain_name"); system("mkdir -p $domain_home_dir/$domain_name/stat"); //create symlink if(!is_dir($domain_home_dir."/".$zone)) system("mkdir $domain_home_dir/$zone"); system("ln -s $domain_home_dir/$domain_name $domain_home_dir/$zone/$domen"); system("chown $user_id:$group_id $domain_home_dir/$zone -R"); system("chown $user_id:$group_id $domain_home_dir/$domain_name -R"); } ?>