Build and install Yaws

Yaws used to be hosted at Sourceforge, but as of release 1.81 yaws is hosted at github.

The github page is http://github.com/klacke/yaws

Tested releases are downloadable from the Yaws download directory at http://yaws.hyber.org/download

To check out the latest release and build a number of prerequisites are required. (All code example below on Ubuntu)

To check out the sources do

# git clone git://github.com/klacke/yaws.git
    

To build and to what is knows as a local install, e.g. a developer install do:

# cd yaws
# autoconf; ./configure; make; make local_install
    

Alternatively, to make a proper install

# cd yaws
# ./configure --help
# ./configure --localstatedir=/var --sysconfdir=/etc
# make
# make install
    

The above commands will checkout the HEAD source, build it and install it at 127.0.0.1:80 with the docroot set to the local documentation.

make (without install) will build the yaws system and make local_install does a local install at http://127.0.0.1:8000

This is the typical mode of operation while either just trying out yaws, or hacking yaws. This will install a template configuration file yaws.conf in $HOME. If $HOME/yaws.conf exists, the old file will not be overwritten.

To run a locally installed system, we run the yaws script found in the bin directory in the source code tree or $HOME/bin/yaws.

make install will also build the yaws system and also install it in /usr/local. A configuration file /etc/yaws/yaws.conf will also be installed unless the file already exists. The default config file will set up the system to listen on http://127.0.0.1:80

Running yaws

The yaws executable is a shell script which invokes the erlang system and instructs it to start yaws. The command line flags for yaws are documented in man page for yaws(1)

When developing yaws code, the interactive mode is ideal. Typically " yaws is then started as:

# yaws -i
       

Run yaws as a daemon as

# yaws --daemon
       

All command line flags to yaws are described in the man page for yaws.

Configuring Yaws

Web server configuration can be supplied to yaws " in either of two ways depending on whether we run yaws as a standalone daemon or if we run yaws as an embedded application inside another Erlang program.

The yaws configuration is described in man page for yaws.conf (5)

Embedded mode

It is possible to run yaws in embedded mode where yaws is part of a larger application. When running yaws in embedded mode, it is often not possible to let yaws read its configuration data from /etc/yaws/yaws.conf.

The function yaws_api:setconf(Gconf, Groups) can be used by an other erlang process to explicitly set a yaws configuration at runtime. To execute Yaws in embedded mode, it must be started with the environment {embedded, true}

The embedded mode is fully described at embed.yaws

Valid XHTML 1.0!