This file is indexed.

/usr/share/doc/ocsigenserver/manual-wiki/staticmod.wiki is in ocsigenserver-doc 2.2.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
=Staticmod=
Staticmod is a module allowing to serve static pages (files).
==Configuration
===Basics

To use that extension, first load it from the configuration file:
{{{
<extension findlib-package="ocsigenserver.ext.staticmod"/>
}}}
Then configure your hosts as in this example:
{{{
<static dir="/path/to/the/local/directory" />
}}}
Note that when running Ocsigenserver as a daemon, a relative path is
interpreted starting at ##/##.

===Rewriting URLs

You may also want to filter or rewrite URLs, as in this example, that allows user to have their home pages:
{{{
<static regexp="~([^/]*)(.*)" dest="/home/\1/public_html\2"/>
}}}
{{{regexp}}} is a regular expression using PERL syntax (PCRE).

Actually, for user's pages, it is better to do:
{{{
<static regexp="~([^/]*)(.*)" dest="$u(\1)/public_html\2"/>
}}}
{{{$u(toto)}}} will be replaced by the home directory for user toto.

You can also specify the option root as in
{{{
<static regexp="~([^/]*)(.*)" dest="$u(\1)/public_html\2" root="$u(\1)/public_html"/>
}}}
This will wave all symlinks checks above the directory {{{u(\1)/public_html}}}. This option is not permitted inside userconf files.

===Catching HTTP errors

Here is an example on how to set a default error page for all 40x errors:
{{{
<static code="40." regexp=".*" dest="/your/error/page.html"/>
}}}
{{{code}}} is a regular expression (here matching 400, 401 etc.). {{{regexp}}} is optional (matches the URL path).

Note that if you want to catch errors from all sites, you need to put this configuration in a separate <site path="">at the end of your configuration file.

===Max-age and Expires

Here is an example on how to set up the {{{Cache-control: max-age}}}
and {{{Expires}}} HTTP headers:

{{{
<static dir="/path/to/the/local/directory" cache="2678400" />
}}}

The {{{cache}}} argument is given in seconds. (1 month in the example)

When the {{{cache}}} argument is {{{0}}} or {{{no}}}, the
{{{Cache-control: no-cache}}} header is sent.

===Staticmod and userconf

(version 1.2.0 and greater)

Staticmod is authorized inside userconf files, but all paths specified by dir or dest must be relative, and cannot contain "{{{/../}}}" or end by "{{{/..}}}". The relative paths are concatenated with the result of evaluating the attribute localpath of userconf.


===Other options

See also module extendconfiguration for some options, like the ability to follow symlinks or to display directories. In particular, the old syntax {{{readable="readable"}}} is no longer available in staticmod (but can be simulated by the option {{{listdirs}}} of extendconfiguration).