In this post I will show how to install the ScriptBasic application server. (sbhttpd.exe) Just like scriba.exe, the sbhttpd.exe application server uses the scriba.conf file for it's configuration. The file is in a binary format created with the scriba -k option. For this demonstration, we are going to use a minimal server configuration and add other options later.
The first step is to save a text copy of the current scriba.conf file. This is done using the following console mode command in the C:\scriptbasic\bin directory.
scriba -D > scriba.conf.save
Copy the below configuration to a scriba.conf.txt file in your C:\scriptbasic\bin directory. We need to convert this text version of scriba.conf to it's needed binary form.
scriba -k scriba.conf.txt
This will create a new binary scriba.conf file that ScriptBasic needs.
dll ".dll"
module "c:\\scriptbasic\\modules\\"
include "c:\\scriptbasic\\include\\"
docu "c:\\scriptbasic\\doc\\"
maxinclude 100
maxstep 0
maxlocalstep 0
maxlevel 3000
maxmem 0
servers (
server (
port 8080
ip "127.0.0.1"
protocol "http"
)
threads 20
listenbacklog 3
home "C:\\xampp\\htdocs\\app-bin\\"
proxyip 1
pid (
file "c:\\scriptbasic\\httpdlog\\pid.txt"
delay 10
wait (
period 10
length 1
)
)
vdirs (
dir "/util/:c:\\scriptbasic\\web\\"
)
errmsgdest 3
nolog 0
log (
panic (
file "c:\\scriptbasic\\httpdlog\\panic.log"
)
app (
file "c:\\scriptbasic\\httpdlog\\app.log"
)
err (
file "c:\\scriptbasic\\httpdlog\\err.log"
)
hit (
file "c:\\scriptbasic\\httpdlog\\hit.log"
)
stat (
file "c:\\scriptbasic\\httpdlog\\stat.log"
)
)
msg404 """
<HTML>
<HEAD>
<TITLE>Error 404 page not found</TITLE>
</HEAD>
<BODY>
<FONT FACE=\"Verdana\" SIZE=\"2\">
<H1>Page not found</H1>
We regretfully inform you that the page you have requested can not be found on this server.
<p>
In case you are sure that this is a server configuration error, please contact
<FONT SIZE=\"3\"><TT>root@localhost</TT></FONT>
</FONT>
</BODY>
</HTML>
"""
code404 "200 OK"
)
Create a C:\xampp\htdocs\app-bin directory as a 'stub' for the proxy to ScriptBasic.
Create a C:\scriptbasic\web directory and copy the C:\xampp\cgi-bin\echo.bas into this directory. You will need to edit the three references to "/cgi-bin/echo.bas" in the form section and change it to "/app-bin/util/echo.bas". This allows mapping your web apps outside the Apache web root for an extra level of security.
To install the ScriptBasic application server as a NT service, type the following command.
sbhttpd -install
Setting the sbhttpd to automatic will start the server at boot time. Use the Windows services feature to start/stop the server if changes to the scriba.conf are made.
Next we need to modify the Apache C:\xampp\apache\conf\httpd.conf file to add the proxy support for ScriptBasic.
Enable the following Apache modules by removing the "#" character at the beginning of the line.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Add the following lines to httpd.conf file to configure the ScriptBasic application server as a proxy server. All URL requests made to the /app-bin (and it's virtual assigned directories) will be forwarded to sbhttpd.exe for processing.
ProxyRequests Off
ProxyPass /app-bin/
http://127.0.0.1:8080/ProxyPassReverse /app-bin/
http://127.0.0.1:8080/Save the file and restart the Apache web server for the changes to take affect.
The following browser screen shot shows echo.bas running on the application server rather then a CGI program on Apache.
The next post will cover how to use the MT extension for in memory session support.