-
Notifications
You must be signed in to change notification settings - Fork 107
Getting Started With ULib
Firstly a huge thankyou to Stefano Casazza not only for making ULib but for his patience in answering all my questions.
UServer is a extensible plugin based web server that is build on top of ULib.
ULib is installed as a set of shared object libraries and header files (like Boost).
git clone https://github.com/stefanocasazza/ULib.git
If you haven't had much experience playing with make read the config help or:
./configure -h
Having now decided on what features you need let ./configure do its magic.
For example:
./configure --enable-debug --with-sqlite3
make
sudo make install
Assuming you haven't changed the PREFIX make will install userver to /usr/local
At this point we need to configure /usr/local/etc/userver.cfg The file is well annotated at a bare minimum setup the following values:
userver {
DOCUMENT_ROOT /srv/http
LOG_FILE userver.log
#PLUGIN "http"
#PLUGIN_DIR /usr/local/libexec
# Database (ORM) settings
ORM_DRIVER "sqlite"
#ORM_DRIVER_DIR /usr/local/libexec
}
userver_tcp expects some environment variables for debugging and database (ORM) functions to save typing it is easiest to put these into a bash script like this:
#!/bin/sh
# Database
export ORM_DRIVER="sqlite"
export ORM_OPTION="host=localhost user=benchmarkdbuser password=benchmarkdbpass character-set=utf8 dbname=../db/fortune"
# Debug
export UTRACE="0 20M 0"
export UTRACE_SIGNAL="0 20M 0"
export UOBJDUMP="0 10M 100"
export USIMERR="error.sim"
userver_tcp #-c /usr/local/etc/userver.cfg
Once you have configured your userver.cfg and placed the relevant html documents in your docroot just execute the bash script above.
Point your browser to localhost/filename you should now have a working server.
userver offers a wide variety of ways to generate dynamic content depending on your needs:
- Server Side Includes
- ULib Servlet Pages
- General CGI (has shell support)
- Support for running Ruby on Rails applications natively (experimental).
- Support for running PHP applications (experimental).
As with all web servers do not run them as the root user. This introduction has been written to give you an idea of the ULib/UServer workflow. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It is your responsibility to secure your web server and follow sound security conscious programming practices.