Fossil SCM

Swapped the simple foo.net "whole site is Fossil" example in www/server/debian/nginx.md for the more complicated example.com one where only /code is served by Fossil. This is probably going to be more common, and it shows off the important detail of setting SCRIPT_NAME properly. Made a minor adjustment to any/scgi.md to track this change, so there is not a pointless difference between these two nginx configs.

wyoung 2019-08-25 12:29 trunk
Commit 653e90ca6277eea53426b6bd78d3f75bd319195b9e1e950f6a68e2ffc63e6dd0
--- www/server/any/scgi.md
+++ www/server/any/scgi.md
@@ -9,27 +9,27 @@
99
This can be used with a web server such as [nginx](http://nginx.org)
1010
which does not support [Fossil’s CGI mode](./cgi.md).
1111
1212
A basic nginx configuration to support SCGI with Fossil looks like this:
1313
14
- location /example/ {
14
+ location /code/ {
1515
include scgi_params;
16
- scgi_param SCRIPT_NAME "/example";
16
+ scgi_param SCRIPT_NAME "/code";
1717
scgi_pass localhost:9000;
1818
}
1919
2020
The `scgi_params` file comes with nginx, and it simply translates nginx
2121
internal variables to `scgi_param` directives to create SCGI environment
2222
variables for the proxied program; in this case, Fossil. Our explicit
2323
`scgi_param` call to define `SCRIPT_NAME` adds one more variable to this
2424
set, which is necessary for this configuration to work properly, because
2525
our repo isn’t at the root of the URL hierarchy. Without it, when Fossil
26
-generates absolute URLs, they’ll be missing the `/example` part at the
26
+generates absolute URLs, they’ll be missing the `/code` part at the
2727
start, which will typically cause [404 errors][404].
2828
2929
The final directive simply tells nginx to proxy all calls to URLs under
30
-`/example` down to an SCGI program on TCP port 9000. We can temporarily
30
+`/code` down to an SCGI program on TCP port 9000. We can temporarily
3131
set Fossil up as a server on that port like so:
3232
3333
$ fossil server /path/to/repo.fossil --scgi --localhost --port 9000 &
3434
3535
The `--scgi` option switches Fossil into SCGI mode from its default,
3636
--- www/server/any/scgi.md
+++ www/server/any/scgi.md
@@ -9,27 +9,27 @@
9 This can be used with a web server such as [nginx](http://nginx.org)
10 which does not support [Fossil’s CGI mode](./cgi.md).
11
12 A basic nginx configuration to support SCGI with Fossil looks like this:
13
14 location /example/ {
15 include scgi_params;
16 scgi_param SCRIPT_NAME "/example";
17 scgi_pass localhost:9000;
18 }
19
20 The `scgi_params` file comes with nginx, and it simply translates nginx
21 internal variables to `scgi_param` directives to create SCGI environment
22 variables for the proxied program; in this case, Fossil. Our explicit
23 `scgi_param` call to define `SCRIPT_NAME` adds one more variable to this
24 set, which is necessary for this configuration to work properly, because
25 our repo isn’t at the root of the URL hierarchy. Without it, when Fossil
26 generates absolute URLs, they’ll be missing the `/example` part at the
27 start, which will typically cause [404 errors][404].
28
29 The final directive simply tells nginx to proxy all calls to URLs under
30 `/example` down to an SCGI program on TCP port 9000. We can temporarily
31 set Fossil up as a server on that port like so:
32
33 $ fossil server /path/to/repo.fossil --scgi --localhost --port 9000 &
34
35 The `--scgi` option switches Fossil into SCGI mode from its default,
36
--- www/server/any/scgi.md
+++ www/server/any/scgi.md
@@ -9,27 +9,27 @@
9 This can be used with a web server such as [nginx](http://nginx.org)
10 which does not support [Fossil’s CGI mode](./cgi.md).
11
12 A basic nginx configuration to support SCGI with Fossil looks like this:
13
14 location /code/ {
15 include scgi_params;
16 scgi_param SCRIPT_NAME "/code";
17 scgi_pass localhost:9000;
18 }
19
20 The `scgi_params` file comes with nginx, and it simply translates nginx
21 internal variables to `scgi_param` directives to create SCGI environment
22 variables for the proxied program; in this case, Fossil. Our explicit
23 `scgi_param` call to define `SCRIPT_NAME` adds one more variable to this
24 set, which is necessary for this configuration to work properly, because
25 our repo isn’t at the root of the URL hierarchy. Without it, when Fossil
26 generates absolute URLs, they’ll be missing the `/code` part at the
27 start, which will typically cause [404 errors][404].
28
29 The final directive simply tells nginx to proxy all calls to URLs under
30 `/code` down to an SCGI program on TCP port 9000. We can temporarily
31 set Fossil up as a server on that port like so:
32
33 $ fossil server /path/to/repo.fossil --scgi --localhost --port 9000 &
34
35 The `--scgi` option switches Fossil into SCGI mode from its default,
36
--- www/server/debian/nginx.md
+++ www/server/debian/nginx.md
@@ -161,49 +161,53 @@
161161
On Debian and Ubuntu systems the primary user-level configuration file
162162
for nginx is `/etc/nginx/sites-enabled/default`. I recommend that this
163163
file contain only a list of include statements, one for each site that
164164
server hosts:
165165
166
- include local/example
167
- include local/foo
166
+ include local/example.com
167
+ include local/foo.net
168168
169169
Those files then each define one domain’s configuration. Here,
170
-`/etc/nginx/local/example` contains the configuration for
171
-`*.example.com` and `*.example.net`; and `local/foo` contains the
172
-configuration for `*.foo.net`.
170
+`/etc/nginx/local/example.com` contains the configuration for
171
+`*.example.com` and its alias `*.example.net`; and `local/foo.net`
172
+contains the configuration for `*.foo.net`.
173173
174
-The configuration for our `foo.net` web site, stored in
175
-`/etc/nginx/sites-enabled/local/foo` is:
174
+The configuration for our `example.com` web site, stored in
175
+`/etc/nginx/sites-enabled/local/example.com` is:
176176
177177
server {
178
- server_name .foo.net;
178
+ server_name .example.com .example.net "";
179179
include local/generic;
180180
181
- access_log /var/log/nginx/foo.net-https-access.log;
182
- error_log /var/log/nginx/foo.net-https-error.log;
181
+ access_log /var/log/nginx/example.com-https-access.log;
182
+ error_log /var/log/nginx/example.com-https-error.log;
183183
184
- # Bypass Fossil for the static Doxygen docs
185
- location /doc/html {
186
- root /var/www/foo.net;
184
+ # Bypass Fossil for the static documentation generated from
185
+ # our source code by Doxygen, so it merges into the embedded
186
+ # doc URL hierarchy at Fossil’s $ROOT/doc without requiring that
187
+ # these generated files actually be stored in the repo. This
188
+ # also lets us set aggressive caching on these docs, since
189
+ # they rarely change.
190
+ location /code/doc/html {
191
+ root /var/www/example.com/code/doc/html;
187192
188193
location ~* \.(html|ico|css|js|gif|jpg|png)$ {
189194
expires 7d;
190195
add_header Vary Accept-Encoding;
191196
access_log off;
192197
}
193198
}
194199
195200
# Redirect everything else to the Fossil instance
196
- location / {
201
+ location /code {
197202
include scgi_params;
203
+ scgi_param SCRIPT_NAME "/code";
198204
scgi_pass 127.0.0.1:12345;
199
- scgi_param HTTPS "on";
200
- scgi_param SCRIPT_NAME "";
201205
}
202206
}
203207
204
-As you can see, this is a simple extension of [the basic nginx service
208
+As you can see, this is a pure extension of [the basic nginx service
205209
configuration for SCGI][scgii], showing off a few ideas you might want to
206210
try on your own site, such as static asset proxying.
207211
208212
The `local/generic` file referenced above helps us reduce unnecessary
209213
repetition among the multiple sites this configuration hosts:
@@ -221,10 +225,10 @@
221225
the `access_log` and `error_log` directives, which follow an obvious
222226
pattern from one host to the next. Sadly, you must tolerate some
223227
repetition across `server { }` blocks when setting up multiple domains
224228
on a single server.
225229
226
-The configuration for `example.com` and `example.net` is similar.
230
+The configuration for `foo.net` is similar.
227231
228232
See [the nginx docs](http://nginx.org/en/docs/) for more ideas.
229233
230234
*[Return to the top-level Fossil server article.](../)*
231235
--- www/server/debian/nginx.md
+++ www/server/debian/nginx.md
@@ -161,49 +161,53 @@
161 On Debian and Ubuntu systems the primary user-level configuration file
162 for nginx is `/etc/nginx/sites-enabled/default`. I recommend that this
163 file contain only a list of include statements, one for each site that
164 server hosts:
165
166 include local/example
167 include local/foo
168
169 Those files then each define one domain’s configuration. Here,
170 `/etc/nginx/local/example` contains the configuration for
171 `*.example.com` and `*.example.net`; and `local/foo` contains the
172 configuration for `*.foo.net`.
173
174 The configuration for our `foo.net` web site, stored in
175 `/etc/nginx/sites-enabled/local/foo` is:
176
177 server {
178 server_name .foo.net;
179 include local/generic;
180
181 access_log /var/log/nginx/foo.net-https-access.log;
182 error_log /var/log/nginx/foo.net-https-error.log;
183
184 # Bypass Fossil for the static Doxygen docs
185 location /doc/html {
186 root /var/www/foo.net;
 
 
 
 
 
187
188 location ~* \.(html|ico|css|js|gif|jpg|png)$ {
189 expires 7d;
190 add_header Vary Accept-Encoding;
191 access_log off;
192 }
193 }
194
195 # Redirect everything else to the Fossil instance
196 location / {
197 include scgi_params;
 
198 scgi_pass 127.0.0.1:12345;
199 scgi_param HTTPS "on";
200 scgi_param SCRIPT_NAME "";
201 }
202 }
203
204 As you can see, this is a simple extension of [the basic nginx service
205 configuration for SCGI][scgii], showing off a few ideas you might want to
206 try on your own site, such as static asset proxying.
207
208 The `local/generic` file referenced above helps us reduce unnecessary
209 repetition among the multiple sites this configuration hosts:
@@ -221,10 +225,10 @@
221 the `access_log` and `error_log` directives, which follow an obvious
222 pattern from one host to the next. Sadly, you must tolerate some
223 repetition across `server { }` blocks when setting up multiple domains
224 on a single server.
225
226 The configuration for `example.com` and `example.net` is similar.
227
228 See [the nginx docs](http://nginx.org/en/docs/) for more ideas.
229
230 *[Return to the top-level Fossil server article.](../)*
231
--- www/server/debian/nginx.md
+++ www/server/debian/nginx.md
@@ -161,49 +161,53 @@
161 On Debian and Ubuntu systems the primary user-level configuration file
162 for nginx is `/etc/nginx/sites-enabled/default`. I recommend that this
163 file contain only a list of include statements, one for each site that
164 server hosts:
165
166 include local/example.com
167 include local/foo.net
168
169 Those files then each define one domain’s configuration. Here,
170 `/etc/nginx/local/example.com` contains the configuration for
171 `*.example.com` and its alias `*.example.net`; and `local/foo.net`
172 contains the configuration for `*.foo.net`.
173
174 The configuration for our `example.com` web site, stored in
175 `/etc/nginx/sites-enabled/local/example.com` is:
176
177 server {
178 server_name .example.com .example.net "";
179 include local/generic;
180
181 access_log /var/log/nginx/example.com-https-access.log;
182 error_log /var/log/nginx/example.com-https-error.log;
183
184 # Bypass Fossil for the static documentation generated from
185 # our source code by Doxygen, so it merges into the embedded
186 # doc URL hierarchy at Fossil’s $ROOT/doc without requiring that
187 # these generated files actually be stored in the repo. This
188 # also lets us set aggressive caching on these docs, since
189 # they rarely change.
190 location /code/doc/html {
191 root /var/www/example.com/code/doc/html;
192
193 location ~* \.(html|ico|css|js|gif|jpg|png)$ {
194 expires 7d;
195 add_header Vary Accept-Encoding;
196 access_log off;
197 }
198 }
199
200 # Redirect everything else to the Fossil instance
201 location /code {
202 include scgi_params;
203 scgi_param SCRIPT_NAME "/code";
204 scgi_pass 127.0.0.1:12345;
 
 
205 }
206 }
207
208 As you can see, this is a pure extension of [the basic nginx service
209 configuration for SCGI][scgii], showing off a few ideas you might want to
210 try on your own site, such as static asset proxying.
211
212 The `local/generic` file referenced above helps us reduce unnecessary
213 repetition among the multiple sites this configuration hosts:
@@ -221,10 +225,10 @@
225 the `access_log` and `error_log` directives, which follow an obvious
226 pattern from one host to the next. Sadly, you must tolerate some
227 repetition across `server { }` blocks when setting up multiple domains
228 on a single server.
229
230 The configuration for `foo.net` is similar.
231
232 See [the nginx docs](http://nginx.org/en/docs/) for more ideas.
233
234 *[Return to the top-level Fossil server article.](../)*
235

Keyboard Shortcuts

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