Skip to content

Commit

Permalink
""
Browse files Browse the repository at this point in the history
git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@79 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information
Claes Wikstrom committed Jun 13, 2002
1 parent 3b9e4a1 commit 639b7c2
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 263 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = src scripts
SUBDIRS = src scripts man


all debug clean install:
Expand Down
10 changes: 10 additions & 0 deletions man/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

include ../include.mk

install:
install -d $(INSTALLPREFIX)/man/man1
install -d $(INSTALLPREFIX)/man/man5
cp yaws.1 $(INSTALLPREFIX)/man/man1
cp yaws.conf.5 $(INSTALLPREFIX)/man/man5

all debug clean:
57 changes: 57 additions & 0 deletions man/yaws.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.TH YAWS "1" "" "" "User Commands"
.SH NAME
yaws \- yet another webserver
.SH SYNOPSIS
.B yaws
[\fIOPTIONS\fR]
.SH DESCRIPTION
.\" Add any additional description here
.PP
Yaws is fast lightweight webserver. It can run as daemon or
in interactive mode where it is possible to directly interact
with the webserver. Yaws is particularly good at generating
dynamic content. See the user docs for more information on that topic.

.TP
\fB\-i\fR
Interactive mode. This will start yaws in interactive mode with an erlang
prompt. All error_logger messages will be written to the tty as well in this
mode. Use this when developing yaws code.
.TP
\fB\-D\fR
Daemon mode. This will start yaws as a daemon.
.TP
\fB\-d\fR
Debug mode. This will produce some auxilliary error output for some
error conditions.
.TP
\fB\-c file\fR
Use a different configuration file than the default. The default configuration file
when running as root is /etc/yaws.conf. When running as a non priviliged user, yaws
will search for its configuration file in the following order. First in
$HOME/yaws.conf, then in ./yaws.conf and finally in /etc/yaws.conf
.TP
\fB\-t\fR
Traffic trace mode. All traffic will be written to a trace file called trace.traffic
in the log directory.
.TP
\fB\-T\fR
HTTP trace mode. All HTTP messages will be written to a trace file called trace.http
in the log directory.
.TP
\fB\-h\fR
HUP the daemon. This forces the daemon to reread the configuration file. It also makes
the daemon epty all its internal content caches. Hence when updating the doc root,
HUPing the daemon is the fastest way to see the content updates.
.TP
\fB\-s\fR
Stop the daemon.
.TP
\fB\-v\fR
output version information and exit
.SH AUTHOR
Written by Claes Wikstrom
.SH "SEE ALSO"
.BR yaws.conf (5)
.BR erl (1)

182 changes: 182 additions & 0 deletions man/yaws.conf.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
.TH YAWS.CONF "5" "" "" "User Commands"
.SH NAME
/etc/yaws.conf \- Configuration file for the yaws webserver
.SH DESCRIPTION
.\" Add any additional description here
.PP
Yaws is fast lightweight webserver. It reads a configuration file called
yaws.conf to control its operations. The configuration contains two distinct
parts a global part which affects all the virtual hosts and a server part
where options for each virtual host is supplied.

.SH GLOBAL PART
.TP
\fB\logdir = Directory\fR
All yaws logs will be written to files in this directory. There are several
different log files written by yaws.

.br
\fBreport.log\fR - this is a text file that contains all error logger
printouts from yaws.
.br
\fBHost.access\fR - for each virtual host served by yaws, a file Host.access
will be written which contains an access log in Common Log Format.
.br
\fBtrace.http\fR - this file contains the HTTP trace if that is enabled
.br
\fBtrace.traffic\fR - this file contains the traffic trace if that is enabled

.TP
\fB ebin_dir = Directory\fR
This directive adds Directory to the erlang search path. It is possible to
have several of these command in the configuration file.
.TP
\fB include_dir = Directory\fR
This directive adds Directory to the path of directories where the erlang
compiler seraches for include files. We need to use this if we want to
include .hrl files in our yaws erlang code.
.TP
\fB max_num_cached_files = Integer\fR
Yaws will cache small files such as commonly accessed GIF images in RAM.
This directive sets a maximum number on the number of cached files.
The default value is 400.
.TP
\fB max_num_cached_bytes = Integer\fR
This directive controls the total amount of RAM which can maximally be
used for cached RAM files. The default value is 1000000, 1 megabyte.
.TP
\fB max_size_cached_file = Integer\fR
This directive sets a maximum size on the files that are RAM cached by yaws.
The default value i 8000, 8 kBytes.
.TP
\fB trace = traffic | http\fR
This enables traffic or http tracing. Tracing is also possible to enable with
a command line flag to yaws.
.SH SERVER PART
Yaws can virthost several webservers on the same ip address as well
as several webservers on different ip addresses. The on limitation here is
that there can be only one server with ssl enabled per each individual ip address.
.pp
Each virttual host is defined within a matching pair of \fB<server ServerName>\fR
and \fB</server>\fR. The ServerName will be the name of the webserver.

.pp
The following directives are allowed inside a server definition.
.TP
\fBport = Port \fR
This makes the server listen on Port
.TP
\fB listen = IpAddress\fR
This makes the server listen on IpAddress
.TP
\fB docroot = Directory\fR
This makes the server serve all its content from Directory
.TP
\fB default_server_on_this_ip = true | false\fR
When virthosting several servers on the same ip address, this option
is mandatory. When client requests arrive at the ip address whithout the
HTTP Host: header present, we must know which server is the default.
.TP
\fB ssl = true \fR
This enables ssl for this server
.TP
\fB ssl_keyfile = File\fR
Specifies which file contains the private key for the certificate.
.TP
\fB ssl_certfile = File\fR
Specifies which file contains the certificate for the server.
.TP
\fB ssl_cacertfile = File\fR
File If the server is setup to require client certificates. This file needs to contain all the certificates of the acceptable signers for the client certs.
.TP
\fB ssl_verify = 1 | 2 | 3\fR
Specifies the level of verification the server does on clinet certs. 1 means nothing, 2 means the the server will ask the client for a cert but not fail if the client doesn't supply a client cert, 3 means that the server requires the client to supply a client cert.
.TP
\fB ssl_depth = Int\fR
Specifies the depth of certificate chains the server is prepared to follow when verifying client certs.
.TP
\fB ssl_password = String\fR
String If the private key is encrypted on disc, this password is the 3des key to decrypt it.

.TP
\fB ssl_ciphers = String\fR
* This string specifies the ssl cipher string. The syntax of the ssl cipher string is a little horrible sublanguage of its own. It is documented in the ssl man page for "ciphers".
.SH EXAMPLES

The following example defines a single server on port 80.
.nf

logdir = /var/log/yaws
<server www.mydomain.org>
port = 80
listen = 192.168.128.31
docroot = /var/yaws/www
</server>
.fi

.pp
And this example shows a similar setup but two webservers on the same ip address

.nf

logdir = /var/log/yaws
<server www.mydomain.org>
port = 80
default_server_on_this_ip = true
listen = 192.168.128.31
docroot = /var/yaws/www
</server>

<server www.funky.org>
port = 80
listen = 192.168.128.31
docroot = /var/yaws/www_funky_org
</server>


.fi

And finally a sligthly more complex example
with two servers on the same ip, and one ssl server on a
different ip.

.nf

logdir = /var/log/yaws
max_num_cached_files = 8000
max_num_cached_bytes = 6000000

<server www.mydomain.org>
port = 80
default_server_on_this_ip = true
listen = 192.168.128.31
docroot = /var/yaws/www
</server>



<server www.funky.org>
port = 80
listen = 192.168.128.31
docroot = /var/yaws/www_funky_org
</server>

<server www.funky.org>
port = 443
listen = 192.168.128.32
docroot = /var/yaws/www_funky_org
ssl = true
ssl_keyfile = /etc/funky.key
ssl_cerfile = /etc/funky.cert
ssl_password = gazonk
</server>


.fi

.SH AUTHOR
Written by Claes Wikstrom
.SH "SEE ALSO"
.BR yaws (1)
.BR erl (1)

1 change: 0 additions & 1 deletion scripts/yaws.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
logdir = /var/log/yaws
ebin_dir = %yawsdir%/examples/ebin
include_dir = %yawsdir%/examples/include
keepalive_timeout = 15000



Expand Down
1 change: 0 additions & 1 deletion scripts/yaws.conf.template.local
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
logdir = .
ebin_dir = %yawsdir%/examples/ebin
include_dir = %yawsdir%/examples/include
keepalive_timeout = 15000



Expand Down
4 changes: 4 additions & 0 deletions scripts/yaws.ss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ help()
echo " yaws -c file -- set config file"
echo " yaws -t -- trace all traffic"
echo " yaws -T -- trace http traffic"
echo " yaws -v -- print version"
echo ""
echo ""
echo "ctl functions ... "
Expand Down Expand Up @@ -55,6 +56,9 @@ do
-s)
exec $erl -noshell -pa ${yawsdir}/ebin -s yaws_ctl stop;
exit normal;;
-v)
exec $erl -noshell -pa ${yawsdir}/ebin -s yaws printversion;
exit normal;;
*)
help
esac
Expand Down
6 changes: 6 additions & 0 deletions src/yaws.erl
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,9 @@ oct_to_dig(O) -> oct_to_dig(O, 0).

oct_to_dig([], D) -> D;
oct_to_dig([H|T], D) -> oct_to_dig(T, D*8 + H - $0).



printversion() ->
io:format("Yaws ~s~n", [yaws_vsn:version()]),
init:stop().
13 changes: 8 additions & 5 deletions src/yaws_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
paths() ->
case os:cmd("id -u") of
[$0 |_] -> %% root
["./yaws.conf",
[
"/etc/yaws.conf"];
_ -> %% developer
[filename:join([os:getenv("HOME"), "yaws.conf"]),
Expand Down Expand Up @@ -187,11 +187,11 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->

["trace", '=', Bstr] ->
case Bstr of
"true" ->
fload(FD, globals, GC#gconf{trace = true},
"traffic" ->
fload(FD, globals, GC#gconf{trace = {true, traffic}},
C, Cs, Lno+1, Next);
"false" ->
fload(FD, globals, GC#gconf{trace = undefined},
"http" ->
fload(FD, globals, GC#gconf{trace = {true, http}},
C, Cs, Lno+1, Next);
_ ->
{error, ?F("Expect bool at line ~w",[Lno])}
Expand Down Expand Up @@ -224,6 +224,9 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
false ->
{error, ?F("Expect directory at line ~w", [Lno])}
end;


%% keep this bugger for backward compat for a while
["keepalive_timeout", '=', Val] ->
case (catch list_to_integer(Val)) of
I when integer(I) ->
Expand Down
2 changes: 1 addition & 1 deletion vsn.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
YAWS_VSN=0.50
YAWS_VSN=0.48
Loading

0 comments on commit 639b7c2

Please sign in to comment.