Fossil SCM

1
# Serving via IIS + CGI
2
3
## This Is Not the Method You Are Looking For
4
5
Setting up CGI service under IIS is surprisingly complicated compared to
6
running Fossil as a CGI under most other operating systems. We recommend
7
that you use the simpler [reverse proxying method](./iis.md) instead
8
unless there is some compelling reason why that method cannot work for
9
you, such as its dependence on non-stock IIS extensions. (Keep in mind
10
that both extensions it requires are by Microsoft, not third parties!)
11
12
Once you’ve got this scheme working, it gives the same benefits as those
13
listed at the top of the linked-to document.
14
15
There is a small benefit you get from using CGI over reverse proxying on
16
other OSes, which is that the Fossil program only runs briefly in order
17
to serve each HTTP hit. Once the request is done, that Fossil instance
18
shuts back down, releasing all of its resources. You don’t need to keep
19
a background Fossil HTTP server running full-time to provide CGI-based
20
Fossil service.
21
22
You lose a lot of that benefit on Windows:
23
24
1. It only matters to start with on servers that are highly RAM
25
constrained. (Roughly ≤ 128 MiB.) Our configuration steps below
26
assume you’re using the Windows and IIS GUIs, which have RAM
27
requirements well in excess of this, making Fossil’s resource
28
requirements a drop in the bucket next to them. On the [Azure
29
B1s][b1s] virtual machine I used to prepare these instructions, the
30
Windows Server Manager GUI kept filling the VM’s 1 GiB of RAM
31
during feature installation and crashing. I had to upgrade the VM’s
32
RAM to 2 GiB just to get useful work done!
33
34
2. Process creation on Windows is [much more expensive][cp] than on the
35
other OSes Fossil runs on, so the benefits of firing up a Fossil
36
executable to process each HTTP request are partially swamped by the
37
overhead of doing so.
38
39
Therefore, unless you’re willing to replace all of the GUI configuration
40
steps below with command line equivalents, or shut the GUI down entirely
41
after configuring IIS, CGI is a much less compelling option on Windows.
42
43
**WARNING:** The following tutorial appears to fail with the current
44
(2019-08-17) version of Fossil, [apparently][fbug] due to an inability
45
of Fossil to detect that it’s being run in CGI mode.
46
47
[b1s]: https://azure.microsoft.com/en-us/blog/introducing-b-series-our-new-burstable-vm-size/
48
[cp]: https://stackoverflow.com/a/48244/142454
49
[fbug]: https://fossil-scm.org/forum/forumpost/de18dc32c0
50
51
52
## Install IIS with CGI Support
53
54
The steps for this are identical to those for the [reverse proxying IIS
55
setup](./iis.md#install) except that you need to enable CGI in the last
56
step, since it isn’t installed by default. For Windows Server, the path
57
is:
58
59
![Install CGI in IIS](./cgi-install-iis.png)
60
61
The path is similar on the consumer-focused versions of Windows, once
62
you get to that last step.
63
64
65
## Setup
66
67
1. Install the Fossil executable to `c:\inetpub\wwwroot\bin` on the web
68
server. We can’t use an executable you might already have because IIS
69
runs under a separate user account, so we need to give that
70
executable special permissions, and that’s easiest to do under the
71
IIS tree:
72
73
![IIS fossil.exe execute permission](./cgi-bin-perm.png)
74
75
2. In IIS Manager (a.k.a. `INETMGR`) drill down into the Sites folder
76
in the left-side pane and right-click your web site’s
77
configuration. (e.g. “Default Web Site”)
78
79
3. On that menu say “Add Virtual Directory.” Give it the alias “`cgi`”
80
and point it at a suitable directory, such as
81
“`c:\inetpub\wwwroot\cgi`”.
82
83
4. Double-click the “Handler Mappings” icon, then in the right-side
84
pane, click “Add Script Map...” Apply the following settings:
85
86
![IIS script map dialog](./cgi-script-map.png)
87
88
The Executable path must point to the path we set up in step 1, not
89
to some other `fossil.exe` you may have elsewhere on your system.
90
You will need to change the default “`*.dll`” filter in the Open
91
dialog to “`*.exe`” in order to see it when browsing via the “`...`”
92
button.
93
94
5. Create a file called `repo.fslcgi` within the CGI directory you
95
chose in step 3, with a single line like this:
96
97
repository: c:\Users\SOMEONE\museum\repo.fossil
98
99
Give the actual path to the repository, of course.
100
101
6. Up at the top level of IIS Manager, double-click the “ISAPI and CGI
102
Restrictions” icon, then click “Add...” in the right-side pane.
103
Give the script you just created permission to execute:
104
105
![IIS CGI execute permission](./cgi-exec-perm.png)
106
107
7. In the right-side pane, click “Restart” to apply this configuration,
108
then test it by visiting the newly-available URL in a browser:
109
110
http://localhost/cgi/repo.fslcgi
111
112
For more complicated setups such as “directory” mode, see [the generic
113
CGI instructions](../any/cgi.md).
114
115
*[Return to the top-level Fossil server article.](../)*
116

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button