|
f146e21…
|
drh
|
1 |
# Serving via inetd |
|
f146e21…
|
drh
|
2 |
|
|
f146e21…
|
drh
|
3 |
A Fossil server can be launched on-demand by `inetd` by using the |
|
f146e21…
|
drh
|
4 |
[`fossil http`](/help/http) command. To do so, add a line like the |
|
f146e21…
|
drh
|
5 |
following to its configuration file, typically `/etc/inetd.conf`: |
|
f146e21…
|
drh
|
6 |
|
|
8a1ba49…
|
wyoung
|
7 |
80 stream tcp nowait.1000 root /usr/bin/fossil /usr/bin/fossil http /home/fossil/repo.fossil |
|
f146e21…
|
drh
|
8 |
|
|
f146e21…
|
drh
|
9 |
In this example, you are telling `inetd` that when an incoming |
|
f146e21…
|
drh
|
10 |
connection appears on TCP port 80 that it should launch the program |
|
f146e21…
|
drh
|
11 |
`/usr/bin/fossil` with the arguments shown. Obviously you will need to |
|
f146e21…
|
drh
|
12 |
modify the pathnames for your particular setup. The final argument is |
|
f146e21…
|
drh
|
13 |
either the name of the fossil repository to be served or a directory |
|
f146e21…
|
drh
|
14 |
containing multiple repositories. |
|
f146e21…
|
drh
|
15 |
|
|
f146e21…
|
drh
|
16 |
If you use a non-standard TCP port on systems where the port |
|
f146e21…
|
drh
|
17 |
specification must be a symbolic name and cannot be numeric, add the |
|
f146e21…
|
drh
|
18 |
desired name and port to `/etc/services`. For example, if you want your |
|
f146e21…
|
drh
|
19 |
Fossil server running on TCP port 12345 instead of 80, you will need to |
|
f146e21…
|
drh
|
20 |
add: |
|
f146e21…
|
drh
|
21 |
|
|
8a1ba49…
|
wyoung
|
22 |
fossil 12345/tcp # fossil server |
|
f146e21…
|
drh
|
23 |
|
|
f146e21…
|
drh
|
24 |
and use the symbolic name “`fossil`” instead of the numeric TCP port |
|
f146e21…
|
drh
|
25 |
number (“12345” in the above example) in `inetd.conf`. |
|
f146e21…
|
drh
|
26 |
|
|
f146e21…
|
drh
|
27 |
Notice that we configured `inetd` to launch Fossil as root. See the |
|
f146e21…
|
drh
|
28 |
top-level section on “[The Fossil Chroot |
|
f146e21…
|
drh
|
29 |
Jail](../../chroot.md)” for the consequences of this and |
|
f146e21…
|
drh
|
30 |
alternatives to it. |
|
f146e21…
|
drh
|
31 |
|
|
f146e21…
|
drh
|
32 |
You can instead configure `inetd` to bind to a higher-numbered TCP port, |
|
f146e21…
|
drh
|
33 |
allowing Fossil to be run as a normal user. In that case, Fossil will |
|
f146e21…
|
drh
|
34 |
not put itself into a chroot jail, because it assumes you have set up |
|
f146e21…
|
drh
|
35 |
file permissions and such on the server appropriate for that user. |
|
f146e21…
|
drh
|
36 |
|
|
f146e21…
|
drh
|
37 |
The `inetd` daemon must be enabled for this to work, and it must be |
|
f146e21…
|
drh
|
38 |
restarted whenever its configuration file changes. |
|
f146e21…
|
drh
|
39 |
|
|
f146e21…
|
drh
|
40 |
This is a more complicated method than the [standalone HTTP server |
|
f146e21…
|
drh
|
41 |
method](./none.md), but it has the advantage of only using system |
|
f146e21…
|
drh
|
42 |
resources when an actual connection is attempted. If no one ever |
|
f146e21…
|
drh
|
43 |
connects to that port, a Fossil server will not (automatically) run. It |
|
f146e21…
|
drh
|
44 |
has the disadvantage of requiring "root" access, which may not be |
|
f146e21…
|
drh
|
45 |
available to you, either due to local IT policy or because of |
|
f146e21…
|
drh
|
46 |
restrictions at your shared Internet hosting service. |
|
f146e21…
|
drh
|
47 |
|
|
f146e21…
|
drh
|
48 |
For further details, see the relevant section in your system's |
|
f146e21…
|
drh
|
49 |
documentation. The FreeBSD Handbook covers `inetd` in [this |
|
f146e21…
|
drh
|
50 |
chapter](https://www.freebsd.org/doc/en/books/handbook/network-inetd.html). |
|
f146e21…
|
drh
|
51 |
|
|
f146e21…
|
drh
|
52 |
*[Return to the top-level Fossil server article.](../)* |