|
f146e21…
|
drh
|
1 |
# Standalone HTTP Server |
|
f146e21…
|
drh
|
2 |
|
|
f146e21…
|
drh
|
3 |
The easiest way to set up a Fossil server is to use either the |
|
f146e21…
|
drh
|
4 |
[`server`](/help/server) or [`ui`](/help/ui) command: |
|
f146e21…
|
drh
|
5 |
|
|
f146e21…
|
drh
|
6 |
* **fossil server** _REPOSITORY_ |
|
f146e21…
|
drh
|
7 |
* **fossil ui** _REPOSITORY_ |
|
f146e21…
|
drh
|
8 |
|
|
f146e21…
|
drh
|
9 |
The _REPOSITORY_ argument is either the name of the repository file or a |
|
f146e21…
|
drh
|
10 |
directory containing many repositories named “`*.fossil`”. Both of these |
|
f146e21…
|
drh
|
11 |
commands start a Fossil server, usually on TCP port 8080, though a |
|
f146e21…
|
drh
|
12 |
higher numbered port will be used instead if 8080 is already occupied. |
|
f146e21…
|
drh
|
13 |
|
|
f146e21…
|
drh
|
14 |
You can access these using URLs of the form **http://localhost:8080/**, |
|
f146e21…
|
drh
|
15 |
or if _REPOSITORY_ is a directory, URLs of the form |
|
f146e21…
|
drh
|
16 |
**http://localhost:8080/**_repo_**/** where _repo_ is the base name of |
|
f146e21…
|
drh
|
17 |
the repository file without the “`.fossil`” suffix. |
|
f146e21…
|
drh
|
18 |
|
|
f146e21…
|
drh
|
19 |
There are several key differences between “`ui`” and “`server`”: |
|
f146e21…
|
drh
|
20 |
|
|
f146e21…
|
drh
|
21 |
* “`ui`” always binds the server to the loopback IP address (127.0.0.1) |
|
f146e21…
|
drh
|
22 |
so that it cannot serve to other machines. |
|
f146e21…
|
drh
|
23 |
|
|
f146e21…
|
drh
|
24 |
* Anyone who visits this URL is treated as the all-powerful Setup |
|
f146e21…
|
drh
|
25 |
user, which is why the first difference exists. |
|
fd1282e…
|
drh
|
26 |
|
|
f146e21…
|
drh
|
27 |
* “`ui`” launches a local web browser pointed at this URL. |
|
f146e21…
|
drh
|
28 |
|
|
f146e21…
|
drh
|
29 |
You can omit the _REPOSITORY_ argument if you run one of the above |
|
f146e21…
|
drh
|
30 |
commands from within a Fossil checkout directory to serve that |
|
f146e21…
|
drh
|
31 |
repository: |
|
f146e21…
|
drh
|
32 |
|
|
8a1ba49…
|
wyoung
|
33 |
$ fossil ui # or... |
|
8a1ba49…
|
wyoung
|
34 |
$ fossil server |
|
f146e21…
|
drh
|
35 |
|
|
f146e21…
|
drh
|
36 |
You can abbreviate Fossil sub-commands as long as they are unambiguous. |
|
f146e21…
|
drh
|
37 |
“`server`” can currently be as short as “`ser`”. |
|
f146e21…
|
drh
|
38 |
|
|
f146e21…
|
drh
|
39 |
You can serve a directory containing multiple `*.fossil` files like so: |
|
f146e21…
|
drh
|
40 |
|
|
8a1ba49…
|
wyoung
|
41 |
$ fossil server --port 9000 --repolist /path/to/repo/dir |
|
e40bdbf…
|
andybradford
|
42 |
|
|
e40bdbf…
|
andybradford
|
43 |
As a security precaution, when the “`server`” or |
|
e40bdbf…
|
andybradford
|
44 |
“`ui`” commands are run as `root` Fossil will drop into |
|
e40bdbf…
|
andybradford
|
45 |
a [chroot](../../chroot.md) with the directory where the repository is located |
|
e40bdbf…
|
andybradford
|
46 |
as the new root of the filesystem. |
|
f146e21…
|
drh
|
47 |
|
|
f146e21…
|
drh
|
48 |
There is an [example script](/file/tools/fslsrv) in the Fossil |
|
f146e21…
|
drh
|
49 |
distribution that wraps `fossil server` to produce more complicated |
|
f146e21…
|
drh
|
50 |
effects. Feel free to take it, study it, and modify it to suit your |
|
f146e21…
|
drh
|
51 |
local needs. |
|
f146e21…
|
drh
|
52 |
|
|
f146e21…
|
drh
|
53 |
See the [online documentation](/help/server) for more information on the |
|
f146e21…
|
drh
|
54 |
options and arguments you can give to these commands. |
|
f146e21…
|
drh
|
55 |
|
|
f146e21…
|
drh
|
56 |
*[Return to the top-level Fossil server article.](../)* |