| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
It is based on single-process architecture which provides small memory footprint and exceptionally high performance. For comparison, Bauk is 3-8 times faster than Apache and uses as little as 10% of system resources in a same configuration and usage pattern. Servers that suffer load problems with Apache and barely operate, with Bauk run by speed of lightning. Below is a set of Bauk versus Apache benchmark tests that reflect speed in serving requests, and results can be used as reference values for comparing Bauk to Apache or any other Web server. Benchmark Suite
Benchmark Client Benchmark tests use BaukBench HTTP benchmarking client (comes included with Bauk HTTP server source), it is capable of producing extreme load without consuming large amount of resources on client system. This is important as it means that client will be able to generate high load to test a Web server at it's highest performance and determine max capabilities.Comparable results can be obtained by ApacheBench "ab" client, with keeping number of simultaneous connections lower ie. up to 100 to avoid hitting it's limits. Web Server Configuration Both Bauk and Apache server configs have logging disabled for max performance.Bauk configuration script "bauk.cfg" //VirtualHost "www.domain.com"
vhost_create("single", "www.domain.com", "/home/user/www_domain_com/");
//root URL and path it translates to
vhost_url_path("/", "./html/", "GHP", "lbr");
vhost_url_path("/icons/", "/usr/local/bauk/SHARE/icons/", "GH", "lbr");
vhost_alias("*.domain.com", "123.45.6.78"); //VirtualHost's aliases
vhost_save() ; //store this VirtualHost
/*
Example:
http://www.domain.com/ --> /home/user/www_domain_com/html/
http://www.domain.com/icons/ --> /usr/local/bauk/SHARE/icons/
*/
//MIME types
mime("html,htm", "text/html");
mime("css", "text/css");
mime("bmp", "image/bmp");
mime("gif", "image/gif");
mime("jpg", "image/jpeg");
mime("png", "image/png");
//Main server configuration:
int BAUK_NO = 0;
int BAUK_YES = 1;
int nConnections = 3*1024; //3k simultaneous HTTP connections
//Configure system side of HTTP connections:
system_connection(nConnections); //Number of connections system ques/listen
system_tcpnodelay(BAUK_YES); //TCP 0=delayed=more efficient, 1=no delay=faster
//Bauk HTTP connections parameters:
bauk_connection(
/*simult*/ nConnections, //Max 3k simultaneous connections
/*maxrequests*/ 200000, //Max 200k KeepAlive requests per connection
/*maxpostlen*/ -1, //Max allowed POST/PUT data length
/*writeblock*/ -1, //Connection "write" block, -1 default (ie. 16KB)
/*outputwhole*/ BAUK_NO, //Output whole block, 0 best try, 1 yes, whole block
/*tmaxidle*/ 35, //35 sec connection KeepAlive/idle time
/*tmaxduration*/ 30*60 //30 minutes max request duration
);
//
bauk_workdir("/usr/local/bauk/bin/"); //Bauk working directory
bauk_pidfile("/usr/local/bauk/bin/bauk.pid"); //Pidfile path
bauk_tmp("/usr/local/bauk/tmpfiles/"); //Temp files dir
bauk_usergroup("bauk", "bauk", "e"); //Change user/group; "r" real, "e" effective
bauk_bind("*", 80); //Bind to interface
//Enable GZIP compression
bauk_gzip(5, "html,htm,css,txt,js,xml,wml");
See below chapter Bauk configuration for more detailed "bauk.cfg" script. Apache configuration script "httpd.conf" #
ServerRoot "/usr/local/apache2"
Listen 80
MaxKeepAliveRequests 200000
KeepAliveTimeout 35
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
</IfModule>
ServerAdmin you@example.com
#
DocumentRoot "/usr/local/apache2/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
#
<Directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
DefaultType text/plain
Test Load In benchmark tests the load is created by requests for small 1K HTML file which represents the size of many files such as HTML, CSS style sheets, .gif .jpg .png images etc. typically requested on a server hosting busy and popular sites.This provides stress test that measures speed of requests serving, ie. number of requests served per second. Large files such as ISO downloads, GZIP files, audio and video files, etc. represent absolutely no difficulty for Bauk as it uses single process architecture and large downloads or large number of (slow) connections do not have any negative effect ie. it handles large number of connections without it having any impact on resource usage.
Conclusion High performance level is relevant for all servers hosting high traffic Web sites and operating in extreme and demanding conditions.Bauk HTTP server provides extremely high performance and speed with all tasks, serving static and dynamic content, graphics intensive and Rich Style Web sites, etc. Bauk accomplishes it with maximum efficiency. Installing Bauk or replacing Apache by Bauk provides noticeable difference in both number of clients served in same time unit and much more efficient and effective resource utilization increasing server's overall performance. Check why users rate it so well, Download Bauk. 4. Bauk HTTP Server's Grom connector Bauk HTTP Server's Grom (Thunder) connector is a server interface and library which provide any interpreter with command line interface ability to operate in persistent mode (interpreters compiled and linked with Grom connector library "libgromcgi.a" become capable of executing multiple scripts by a single process before exit).Grom connector has key specific feature that it is universal for large number of interpreters, and it provides persistent process model for extreme performance (for comparison it's 5 times higher than CGI execution and 2.5 times higher than FastCGI). It includes advanced features such as process limits, suexec (interpreters run under real UID of script owner), and allows simple and easy Web scripts management ie. like HTML files, no trouble with file location, permissions, etc., scripts placed in Web directory automatically executed by Web server/interpreter. Bauk HTTP Server provides support for following interpreters/scripting languages:
Persistent Process Model Bauk HTTP Server's Grom connector provides wide range of interpreters with command line interface ability to operate in persistent mode for extremely high performance.Let's take, for example, PHP interpreter, as CGI or from command line it is started by executing the script on path ie. /path/to/script.php. Compiled and linked with Grom persistent interpreter connector library "libgromcgi.a", PHP operates in persistent mode, which now we can call Persistent PHP (gromphp), and in Bauk configuration script "gromphp" is set in charge of executing all *.php files located in Web directory. Accepting the first request for *.php script (or Server-Side JavaScript, Perl, Python, Tcl, etc.) Bauk HTTP Server creates new persistent interpreter process "gromphp" which executes the script, and returns into "idle" state awaiting for next request. All further requests are executed by available persistent interpreter process(es), with new processes automatically created when and if required. The max number of script executions per process ie. 50, 100, 5000, etc. and max number of simultaneous processes ie. 1, 500, 1000 etc., is set in Bauk configuration script, with appropriate idle interpreter timeout value ie. 15 sec, 2 min, 5 hours etc. Here is a sample Bauk configuration script "bauk.cfg" with settings for persistent interpreters: Segment from Bauk configuration script "bauk.cfg"
//configure persistent interpreter connector:
grom_bind("127.0.0.1", 9001); //Grom connector IP and port
grom_limit(
/*nmaxsimultproc*/ 1024, //max simult. persistent interp. processes (PPs)
/*nmaxprocperuser*/ -1, //max simult. PP per user id (scriptfile owner)
/*nmaxchild*/ 50, //max child per PP UID
/*nprio*/ 0, //PP priority 0-20; 0=normal, 20=lowest
/*tmaxconnecting*/ 10, //idle PP connecting time max 10sec
/*tmaxexecution*/ 30, //PP must execute/finish request in max 30sec
/*tmaxidle*/ 15*60, //max PP idle time 15min
/*tmaxsessionvar*/ 365*24*60*60, //max session variable duration 1 year
/*nmaxrss*/ 40*1024*1024, //max 40mb PP RSS (memory footprint), in bytes
/*nmaxfilesize*/ -1, //max allowed file size (-1 for unlimited)
/*nmaxrequests*/ 4500 //max 4500 requests (scripts) by PP before exit
);
//configure persistent interpreters:
//gromphp executes all .php .php4 files
grom_interpreter("/usr/local/bauk/bin/gromphp --GromKeepAlive", "php,php4");
//gromjs executes all .jsx .jsp .jss .sjs files
grom_interpreter("/usr/local/bauk/bin/gromjs --GromKeepAlive", "jsx,jsp,jss,sjs");
//gromperl executes all .pl files
grom_interpreter("/usr/local/bauk/bin/gromperl --GromKeepAlive", "pl");
Please see default Bauk configuration script "bauk.cfg" provided with
Bauk distribution for more details.
Download latest version of Bauk HTTP Server from:
http://www.bauk.ws/Bauk TAR GZIP archive ie. "bauk-n.n.n.tgz" unpacked creates a directory named "bauk-n.n.n" with 'n' being Bauk version numbers. Installation process doesn't move/create any files outside of original dir, allowing administrator to choose suitable location after compilation is complete. Basic steps to compile, install and start Bauk HTTP Server on a Unix-like system are: $ tar xfz bauk-n.n.n.tgz Example Bauk install directory structure
# adduser -s /sbin/nologin bauk
# mkdir /usr/local/bauk/
/usr/local/bauk/ (install dir)
bin/ (bin dir)
bauk.cfg (Bauk config script)
bauk.pid (pidfile)
baukctl.sh (process manager script)
bauk (Bauk Web server executable)
gromjs (persistent SpiderMonkey SSJS interpreter)
gromphp (persistent PHP interpreter)
gromperl (persistent Perl interpreter)
grompython (persistent Python interpreter)
gromtcl (persistent Tcl interpreter)
VHOSTS/ (Virtual Hosts)
www.domain.com/
DVHOSTS/ (Dynamic Virtual Hosts)
www.domain.com/
www.otherdomain.net/
RDPVHOSTS/ (RDP Virtual Hosts)
com/
domain/
www/
SHARE/ (shared data)
icons/
/home/user/www_domain_com/ (user-based Virtual Host)
html/
If using Bauk process manager "baukctl.sh" script edit and set
correct value for pidfile path, and that should be the same value you've set in
Bauk configuration script for pidfile (ie. /usr/local/bauk/bin/bauk.pid).To start Bauk using process manager script: $ ./baukctl.sh start Bauk's process manager script "baukctl.sh" handles and automates server starting/stopping and creation/usage of PID file. Script also features other commands, ie. start, stop, terminate, restart, etc. For brief instructions, type:$ ./baukctl.sh help After start, use program like "ps" or "top" to check whether server is running. Note that in order to have server working on port 80 you may need special system privileges, ie. usually "root" user.Compiling persistent interpreters The procedure of compiling/linking interpreters with Grom persistent interpreter connector library and producing persistent interpreter ie. PHP, Perl,
Below is procedure for compiling persistent PHP interpreter. Compiling/linking interpreters with Grom connector library In this chapter we describe step-by-step procedure for compiling and installing persistent PHP (gromphp) interpreter.This procedure is same for all supported interpreters and description given here can be used for any of them with very little difference. Sample "INSTALL_gromphp.txt" file: Assuming that, when unpacked, Bauk HTTP Server's and PHP source directories are:/path/to/bauk-n.n.n/ /path/to/php-5.2.6/ Step-by-step installation:
Compiling Bauk with SSL/TLS support Bauk HTTP server implements secure hypertext transfer protocol (HTTPS) using Secure Socket Layer/Transport Layer Security (SSL/TLS) provided by OpenSSL library. This section covers the procedure of compiling and linking Bauk HTTP server with OpenSSL library and producing a SSL-enabled version of Bauk HTTP server.Compiling/building Bauk with SSL/TLS support The procedure of compiling Bauk with OpenSSL library is simple and can be performed following these steps:
Generation and installation of OpenSSL self-signed certificate and keys This chapter covers quick method of generating OpenSSL self-signed certificate and keys and their installation. Using self-signed certificate is an option which is preffered in some cases ie. for testing Web server's SSL configuration/setup or personal use.Assuming the hostname that requires SSL connections is "securehost.domain.com":
Bauk server features it's own C-like config script language allowing easy and convinient way to set many of server options, and it supports variables, int and string data types, functions, operators, block and line comments, file inclusion, etc. Below is an example reduced Bauk config script "bauk.cfg" with settings for dynamic VirtualHosts, one custom VirtualHost and PHP, Example Bauk configuration script "bauk.cfg": //enable dynamic VirtualHosts:
vhost_create("dynamic", "/usr/local/bauk/DVHOSTS/");
vhost_url_path("/", "./html/", "GHP", "lbr"); //symlinks, browse, read
vhost_url_path("/wiki/", "./html/wiki/", "GHP", "lbrc"); //"clean" url
vhost_url_path("/icons/", "/usr/local/bauk/SHARE/icons/", "GH", "lbr");
vhost_log("./access.log"); //access log
vhost_save();
/*
Example:
http://www.domain123.com/ --> /usr/local/bauk/DVHOSTS/www.domain123.com/html/
http://www.domain123.com/wiki/abc/def --> /usr/local/bauk/DVHOSTS/www.domain123.com/html/wiki/
http://www.domain123.com/icons/ --> /usr/local/bauk/SHARE/icons/
*/
//custom VirtualHost "www.domain.com", overrides dynamic
vhost_create("single", "www.domain.com", "/home/user/www_domain_com/");
//root URL and path it translates to
vhost_url_path("/", "./html/", "GHP", "lbr");
vhost_url_path("/icons/", "/usr/local/bauk/SHARE/icons/", "GH", "lbr");
vhost_alias("*.domain.com", "123.45.6.78"); //VirtualHost's aliases
//VirtualHost specific MIME types
vhost_mime("html", "text/html; charset=ISO-8859-2");
vhost_log("./access.log"); //access log
vhost_save() ; //store this VirtualHost
/*
Example:
http://www.domain.com/ --> /home/user/www_domain_com/html/
http://www.domain.com/icons/ --> /usr/local/bauk/SHARE/icons/
*/
//configure access log format
//NCSA Common Log Format
//123.45.6.78 - - [Mon, 20 Apr 2009 12:40:22 GMT] "GET /page.html HTTP/1.1" 200 1234
global_format_log("$client_ip - $client_user [$server_date_local] "
+"\"$client_method $client_url $client_protocol\" "
+"$server_status_http $server_object_length\n"
);
//MIME types for all Virtual Hosts
//multiple extensions may be separated by ','
mime("html,htm", "text/html");
mime("txt,log,c,h", "text/plain");
mime("css", "text/css");
mime("bmp", "image/bmp");
mime("gif", "image/gif");
mime("jpg", "image/jpeg");
mime("png", "image/png");
mime("doc", "application/msword");
mime("exe", "application/octet-stream");
mime("pdf", "application/pdf");
mime("js", "application/x-javascript");
mime("zip", "application/zip");
mime("tgz", "application/x-tar");
mime("gz", "application/x-gzip");
mime("bz2", "application/x-bzip2");
mime("mid,mid1,kar", "audio/midi");
mime("mpga,mp2,mp3", "audio/mpeg");
mime("vrm,vrml", "model/vrml");
mime("sgm,sgml", "text/sgml");
mime("wml", "text/vnd.wap.wml");
mime("wmls", "text/vnd.wap.wmlscript");
mime("xml", "text/xml");
mime("mpg,mpe,mpeg", "video/mpeg");
mime("qt,mov", "video/quicktime");
mime("avi", "video/x-msvideo");
//main server configuration:
int BAUK_NO = 0;
int BAUK_YES = 1;
int nConnections = 2500; /*number of simultaneous connections served. Bauk is
capable of serving unlimited number of simult. HTTP
connections with no performance penalty. Choose
number depending on requirements ie. 200, 500, 2000,
etc.*/
//configure system side of HTTP connections:
system_connection(nConnections +1); //number of connections system ques/listen
system_tcpnodelay(BAUK_YES); //0 delayed, 1 no delay
//Bauk HTTP connections parameters:
bauk_connection(
/*simult*/ nConnections, //max 2500 simultaneous connections
/*maxrequests*/ 7500, //max 7500 KeepAlive requests per connection
/*maxpostlen*/ -1, //max allowed POST/PUT data length
/*writeblock*/ -1, //connection "write" block, -1 default (ie. 16KB)
/*outputwhole*/ BAUK_YES, //output whole block, 0 best try, 1 yes, whole block
/*tmaxidle*/ 35, //35 sec connection KeepAlive/idle time
/*tmaxduration*/ 30*60 //30 minutes max request durat., must complete in
);
//configure Bauk server paths:
bauk_chroot("/baukroot/"); //chroot to specified dir
bauk_workdir("/usr/local/bauk/bin/"); //Bauk working directory
bauk_pidfile("/usr/local/bauk/bin/bauk.pid"); //pidfile path
bauk_tmp("/usr/local/bauk/tmpfiles/"); //temp files dir
bauk_usergroup("bauk", "bauk", "e"); //change user/group; "r" real, "e" effective
bauk_bind(
"*", 80,
"123.45.6.78", 2081
); //bind to multiple interfaces/ports
//enable GZIP compression
//arg0 compression level 0-10; 0 fastest, 10 best compression
//list of comma separated extensions for which gzip is enabled
bauk_gzip(5, "html,htm,css,txt,js");
//configure persistent interpreter connector:
grom_bind("127.0.0.1", 9001); //Grom connector IP/port
grom_limit(
/*nmaxsimultproc*/ 1024, //max simult. pers. interpreter processes (PPs)
/*nmaxprocperuser*/ -1, //max simult. PP per user (scriptfile owner)
/*nmaxchild*/ 50, //max child per PPs UID
/*nprio*/ 0, //PP priority 0-20; 0=normal, 20=lowest
/*tmaxconnecting*/ 10, //idle PP connecting time max 10sec
/*tmaxexecution*/ 30, //PP must execute/finish request in max 30sec
/*tmaxidle*/ 15*60, //max PP idle time 15min
/*tmaxsessionvar*/ 365*24*60*60, //max session variable duration 1 year
/*nmaxrss*/ 40*1024*1024, //max 40mb PP RSS (memory footprint), in bytes
/*nmaxfilesize*/ -1, //max allowed file size (-1 for unlimited)
/*nmaxrequests*/ 4500 //max 4500 requests (scripts) by PP before exit
);
//configure persistent interpreters:
//gromphp executes all .php .php4 files
grom_interpreter("/usr/local/bauk/bin/gromphp --GromKeepAlive", "php,php4");
//gromjs executes all .jsx .jsp .jss .sjs files
grom_interpreter("/usr/local/bauk/bin/gromjs --GromKeepAlive", "jsx,jsp,jss,sjs");
//gromperl executes all .pl files
grom_interpreter("/usr/local/bauk/bin/gromperl --GromKeepAlive", "pl");
For details and all available config options please see default configuration
script "bauk.cfg" provided with Bauk distribution.Also see chapter Bauk HTTP log format for configuring Bauk's log. Bauk executable accepts one argument from command line and it is the name of configuration script, ie. "bauk.cfg". Before starting Bauk, edit configuration script and set the correct path for pidfile: //Segment from Bauk configuration script "bauk.cfg":
//set path for Bauk's pidfile
bauk_pidfile("/usr/local/bauk/bin/bauk.pid");
Save config file and, to start Bauk manually, execute command:
Manually starting Bauk HTTP server $ cd /usr/local/bauk/bin $ ./bauk bauk.cfgAfter configuration script, edit Bauk's process manager script (baukctl.sh) and set the same path for pidfile and set the name of configuration script (default is "bauk.cfg", but any other name may be used ie. "mysrvconfig.cfg"), which will allow process manager script to control Bauk process. After successful start, server will create a file "bauk.pid" containing process identity number (PID) in the specified path, "/usr/local/bauk/bin/bauk.pid". For manually shutting server down by "soft" termination, execute a kill command with HUP signal for that PID, ie. "kill -HUP 1234"; Bauk will complete serving active requests and exit. Server can also be stopped by kill command with no argument ie. "kill 1234" to perform immediate process termination. Manually controling Bauk process Command Action $ ./bauk bauk.cfg [start Bauk HTTP server using bauk.cfg config file] $ kill -HUP 1234 [complete serving requests and exit, soft termination] $ kill 1234 [immediate process termination]For easier administration of Bauk server, process manager script "baukctl.sh" automatically handles the business of starting/stopping Bauk server. Ie. from command line execute command "baukctl.sh start" or "baukctl.sh stop" to start/stop the server, or after making configuration script changes issue command "baukctl.sh restart" to perform a soft process termination and automatic restart of server. For more info run "baukctl.sh help". Controlling Bauk process using process manager script, from command line /usr/local/bauk/bin$ ./baukctl.sh ACTION where 'ACTION' is: start [start server (default config script "bauk.cfg")] stop [stop server, soft termination] term [terminate process] restart [soft term, and restart] help [print available options]If running Bauk with chroot option, ie. within dir "/baukroot/" and changing identity of user/group, then chroot dir must contain a copy of "/etc/" with files which contain user and group information, which allows Bauk to change user/group from within it's chroot root. Files required for user/group change are: /etc/passwd Change working dir to "/baukroot/etc/" and as root issue command such as: $ cp /etc/master.passwd /baukroot/etc/masterpasswd.tmp /baukroot/etc/passwd That's it, server can now change identity when running in chroot box. Bauk HTTP server has fully configurable HTTP log format with info available from over 50 variables including ie. info from client's request header, server response info, VirtualHost's specific data and general server statistical data such as total no. of connections, server status, errors, uptime, etc. Data from client's request includes all variables defined by HTTP/1.1, ie. host, URL, content length etc., and on server side all information from HTTP response ie. requested and served path, HTTP response status, length of response data, server status, errors, etc. HTTP logs are VirtualHost based, each VirtualHost keeps track of it's own requests served and has Web access log located in VirtualHost's home dir. The format of HTTP log is set in Bauk configuration script by "global_format_log()" function which sets the log format for all VirtualHosts. It accepts one argument, format string containing HTTP log variables and literal chars which define the log's format. Bauk HTTP log variables are case-insensitive and begin by a '$' character. For example, one log variable is '$user_agent' or '$client_ip' etc., which contain client's user agent and IP address. An example log format string: global_format_log("$server_date_gmt $client_ip $client_url $server_status_http\n");
In creating a log entry, variable-names within the format-string are replaced
by corresponding values, other characters are used as literal. C-escape
sequence can be used for entering special characters, ie. \" for doublequote,
\n for newline, \r\n for CRLF, etc.Log format examples Here is a simple HTTP log format with server's local date, client's IP, requested URL and server's HTTP-response status:Bauk configuration script "bauk.cfg":
//Example http log format
//Tue, 05 Sep 2006 18:30:21 GMT 123.46.89.32 /webpage.html 200
global_format_log("$server_date_local $client_ip $client_url $server_status_http\n");
Another example, two simple log formats called NCSA "Common" and "Combined" log formats. Adjust the format by adding/removing specific variables and create a format that suits your requirements, or for more details see Bauk configuration script "bauk_format.cfg" with description and additional examples of HTTP log formats. Bauk configuration script "bauk.cfg":
//Example http log format
//long format string is broken into several lines
//NCSA Common Log Format
//123.45.6.78 - - [Tue, 05 Sep 2006 18:30:21 GMT] "GET /webpage.html HTTP/1.1" 200 1234
global_format_log("$client_ip - $client_user [$server_date_local] "
+"\"$client_method $client_url $client_protocol\" "
+"$server_status_http $server_object_length\n"
);
//NCSA Combined Log Format
//123.45.6.78 - - [Tue, 05 Sep 2006 18:30:21 GMT] "GET /webpage.html HTTP/1.1" 200 1234
// "http://www.domain.com/referer.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows)"
// "XYZ=abc"
global_format_log("$client_ip - $client_user [$server_date_local] "
+"\"$client_method $client_url $client_protocol\" "
+"$server_status_http $server_object_length "
+"\"$Referer\" \"$User_Agent\" \"$Cookie\"\n"
);
See complete list of available log variables in the table below.
HTTP log files administration/management HTTP log files management represents an important part of Web server administration and, especially on a busy server, it is common that log files grow very large. Bauk HTTP server uses an advanced HTTP log management mechanism which allows HTTP log files to be renamed/moved or removed (deleted) completely while HTTP service is active with no need for shutting down HTTP server and disturbing HTTP service.This reduces the complexity of server administration as log files can be manipulated in any way required without shutting down HTTP service or causing corrupted log files data and it can be done without any special tool for log files management. Ie. if a log file is moved/deleted, once new HTTP requests are served, Bauk HTTP server creates a new empty log file and records new data. Best method to administer log files would be to first rename/move files and then manipulate (ie. edit, compress, etc.). Example (move existing log to a new filename with datestamp, then gzip): $ cd /tmp/ Authentication scripts define HTTP realm and lists of authorized usernames/passwords and IP's and protect the Web directory they're located in and it's content/subdirs. Additionally, Bauk allows dir-based auth scripts to be located in upper-level dirs (parent dirs) to actual protected resource, including VirtualHost's home dir, if configuration is such that it is "behind" all Web-accessible dirs. Assuming that VirtualHost's home dir is "/home/user/www_domain_com/", ie.: Paths and locations of auth scripts /home/user/www_domain_com/ (VirtualHost's home dir) /home/user/www_domain_com/.ht_authbasic (VirtualHost's dir-based auth script located in it's homedir) /home/user/www_domain_com/html/ (VirtualHost's root URL '/')In order to enable usage of authorization scripts for specific Virtual Host, vhost_url_path() function in Bauk configuration script (bauk.cfg) sets URL with flag "a" which indicates that particular URL requires HTTP authorization. Bauk configuration script "bauk.cfg":
//URL "/auth/" with GET HEAD methods, allow Read and require HTTP authorization
//vhost_url_path(URL, PATH, METHOD, URLFLAGS);
vhost_url_path("/auth/", "./protected/", "GH", "ra");
After that a dir-based authentication script is created and placed in
protected directory or one of it's parent dirs.
Example dir-based HTTP authentication script ".ht_authbasic": #set realm name "Test realm 1" #configure authenticated username/passwords and IP's. #list of values entered one per line and optional comments behind '#' char username1:pswrd1 username2:pswrd2 username3:pswrd3 username4:pswrd4 123.45.6.78 #allow this ip 32.10.1 #allow all from 32.10.1.* 33.5.7.8 #allow all from 33.5.7.8.* 76.231.12 #allow all from 76.231.12.* 91 #allow all from 91.* #eosSee sample authentication script ".ht_authbasic" provided with Bauk distribution. Bauk HTTP server provides forbid-ip scripts access control/restriction mechanism. The advantage of forbid-ip scripts over ip restrictions set in Bauk configscript is that forbidip scripts are interpreted run-time and modifications do not require server restart. Forbid-ip scripts are located in VirtualHost's homedir or/and Bauk's workdir (the global script) and restrict access to virtual host's dirs/subdirs and content. The forbidip script, if located in Bauk's workdir, is global for all VirtualHosts ie. if there is 3000 VirtualHosts restriction applies to all of them. Each virtual host may have it's own script with forbidden IPs within VirtualHost's homedir. Forbid-ip scripts are easy to administer, ie. they can be created manually or by an automated process ie. script/database etc. Paths and locations of forbid-ip scripts /home/user/www_domain_com/ (VirtualHost's home dir) /home/user/www_domain_com/.ht_forbidip (VirtualHost's forbid-ip script) /home/user/www_domain_com/html/ (VirtualHost's root URL '/') /usr/local/bauk/bin/.ht_forbidip (global forbid-ip script in Bauk workdir, optional)In order to enable use of forbid-ip scripts, vhost_options() function in Bauk config script sets option "forbidip" to non-zero value which indicates usage of forbid-ip scripts for that VirtualHost. Bauk configuration script "bauk.cfg": //create VirualHost
vhost_create();
//etc. ...
//enable usage of VirualHost forbidip script
vhost_options("forbidip", 1);
//etc.
Forbid-ip scripts include lists of IP addresses separated by
newline and optional comments behind '#' char.Here is an example forbid-ip script syntax: Example forbid-ip script ".ht_forbidip": #configure list of forbidden IP's 33.45.1.23 #forbid this IP 123.35.67 #forbid all from 123.35.67.* 40.55 #forbid all from 40.55.* 172 #forbid all from 172.* #eosAfter placing forbid script in in VirtualHost's homedir or/and Bauk's workdir server denies access to addresses listed in script. See sample forbid-ip script ".ht_forbidip" provided with Bauk distribution. Auto generated directory listings Bauk HTTP server provides auto generated directory listings with templating capability by usage of header/footer HTML files.On request for URL which translates to path of a directory on server's local filesystem, if URL flag allows browsing, Bauk server generates listing of directory contents and adds custom header/footer and title/signature HTML files if available. The procedure of generating dirlists and placement of static HTML files is following: Server generated dirlist HTML consisted of [.ht_header.html] [.ht_title.html] [server generated dirlist] [.ht_signature.html] [.ht_footer.html]Generating directory listing, Bauk server attempts to locate header/footer/title/signature files in current dir, vhost's home dir or Bauk's workdir, in that order. Ie. if requested URL is http://www.domain.com/subdir/, and VirtualHost's homedir is "/home/user/www.domain.com/", Bauk HTTP server will attempt to locate files in following dirs: Location of static HTML header/footer/title/signature files /home/user/www.domain.com/html/subdir/ (VirtualHost's current dir) /home/user/www.domain.com/ (VirtualHost's home dir) /usr/local/bauk/bin/ (Bauk's working dir)This allows templating capability, placing ie. header/footer files in Bauk work dir makes a template for ie. 3000 Virtual Hosts. Placing header/footer files in vhosts homedir makes a template for that specific vhost, and placing any of header/footer/title/signature in current dir overrides any parent dir files. For a quick start in CGI programming, see shell CGI script "helloworld.cgi" provided with Bauk distribution . 7. FAQ (frequently asked questions) This chapter covers some of frequently asked questions related to compilation, config and usage of Bauk HTTP server.Q. Compiling Bauk HTTP server in src dir by "make bauk" produces error: Q. Compiling BaukSSL with OpenSSL library on
Linux by instructions from this manual, aborts compilation with linker
returning error: Q. I'm running (threaded) persistent interpreter (Python, Perl, Tcl, ...)
with Bauk HTTP server and experiencing problems. Interpreter (process) executes a single/few scripts,
and then hangs/loops/becomes unresponsive ! Q. Is there a way to limit number of client HTTP connections ? Q. How can I restrict access to my server/VirtualHosts?
Q. How can I increase performance of my HTTP server?
make bauk STATIC=1
Please visit Bauk Web site for most up to date contact info:http://www.bauk.ws/ Environment variables and Web/CGI scripts Bauk HTTP server passes information about client's request to Web scripts/CGI scripts through environment variables. List of available environment variables includes all variables defined by CGI/1.1 specification, and additional variables with details from client's HTTP request header in variables with names starting by HTTP_*. (optional by CGI/1.1 specification)Web scripts/CGI scripts environment variables:
Environment variables provided by Bauk HTTP server in addition to CGI/1.1 defined:
Setting custom environment variables Bauk configuration script function bauk_env() allows setting custom environment variables for Web/CGI scripts. Typical application for setting custom environment variables is providing specific/custom info to scripts, ie. if using SSL/TLS, custom variable "HTTPS" can be set to 1 to make scripts aware that they're executed through secure HTTP connection, ie. scripts can check and abort execution if request is made through non-secure connection.The bauk_env() function can be also used to set the value of built-in variables which allows over-writing of the normal value. For example, if it is required to "hide" sensitive info such as HTTP Authorization and password from scripts these variables can be set to empty value. Bauk configuration script "bauk.cfg": //set custom environment variables
bauk_env("HTTPS","1"); //set variable HTTPS to 1 when using SSL/TLS
bauk_env("HTTP_AUTHORIZATION",""); //delete authorization info
bauk_env("HTTP_AUTHORIZATION_PASSWORD",""); //delete password
bauk_env("XTRAVAR1","abc56"); //set custom variable
bauk_env("XTRAVAR2","efgh678"); //set custom variable
GromJS Server-Side JavaScript interpreter GromJS is a Server-Side JavaScript interpreter based on Mozilla's SpiderMonkey core script engine which provides Web designers / programmers ability to use JavaScript code for creating dynamic pages / scripts on server with same functionality as PHP, CGI, ASP, mod_perl or any other server side scripting solution.GromJS interpreter was developed in 2005. by Bauk HTTP Server development team providing advanced features and complete ASP-like environment for JavaScript More info and examples on GromJS homepage: http://www.bauk.ws/gromjs.html This is brief description of steps in GromJS interpreter installation, for precise instructions see INSTALL file included with package. GromJS Quick Install Steps
Check GromJS page for first time introduction: Examples Below is one sample Hello world type SSJS Web script demonstrating JS scripting on server.Example GromJS Server-Side JavaScript Web script:
//sample Server-Side JavaScript Web script //print environment variables print("<html><body>"); print("<h1>Environment variables</h1><hr>"); print("<pre>"); //print env variable print(Server.getenv("HTTP_USER_AGENT"), "\n"); //Mozilla/5.0 (Windows NT 5.1; en-US) print(Server.getenv("REMOTE_ADDR"), "\n"); //123.45.6.78 //get array of all envvar names var ENVNAMES = Server.varnames(); var cVarnam = 0; //print all names in array, ie. //REQUEST_METHOD = POST //CONTENT_LENGTH = 123 //QUERY_STRING = abc=234 //etc. etc. for ( cVarnam=0; cVarnam<ENVNAMES.length; cVarnam++ ) { var evnam = ENVNAMES[cVarnam]; print(evnam, " = ", Server.getenv(evnam), "\n"); } print("</pre>"); print("</body></html>");See more examples and information on GromJS homepage: http://www.bauk.ws/gromjs.html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||