author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sun, 07 May 2023 11:16:52 +0300 | |
changeset 15 | 3f7b202af99e |
parent 13 | deb/apache-register-2048.bash@7ed40cd96e3a |
child 16 | 667a0417c36a |
permissions | -rw-r--r-- |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
#!/bin/bash |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
|
11
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
3 |
set -x |
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
4 |
|
15
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
5 |
mkdir -p /srv/hg |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
6 |
chown user:user /srv/hg |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
7 |
|
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
8 |
cat <<EOF >/srv/hg/hgweb.cgi |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
9 |
#!/usr/bin/env python |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
10 |
# See also https://mercurial-scm.org/wiki/PublishingRepositories |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
11 |
|
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
12 |
# Path to repo or hgweb config to serve (see 'hg help hgweb') |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
13 |
config = "/srv/hg/hgweb.config" |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
14 |
|
15
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
15 |
from mercurial import demandimport; demandimport.enable() |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
16 |
from mercurial.hgweb import hgweb, wsgicgi |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
17 |
application = hgweb(config) |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
18 |
wsgicgi.launch(application) |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
19 |
EOF |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
20 |
chmod a+xr /srv/hg/hgweb.cgi |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
21 |
|
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
22 |
cat <<EOF >/srv/hg/hgweb.config |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
23 |
[paths] |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
24 |
/ = /srv/hg/* |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
25 |
|
15
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
26 |
[web] |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
27 |
style = gitweb |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
28 |
encoding = "UTF-8" |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
29 |
|
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
30 |
baseurl = / |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
31 |
|
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
32 |
deny_push = * |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
33 |
allow_archive = bz2, gz, zip |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
34 |
EOF |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
35 |
chmod a+r /srv/hg/hgweb.config |
13
7ed40cd96e3a
Possible fix for: AH01630: client denied by server configuration.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
36 |
|
15
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
37 |
cat <<EOF >/etc/apache2/sites-available/hg.conf |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
38 |
<VirtualHost hg.defun.work:*> |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
39 |
DocumentRoot /srv/hg |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
40 |
|
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
41 |
ScriptAliasMatch ^/(.*) /srv/hg/hgweb.cgi$1 |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
42 |
|
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
43 |
<Directory "/srv/hg/"> |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
44 |
Options ExecCGI FollowSymLinks |
13
7ed40cd96e3a
Possible fix for: AH01630: client denied by server configuration.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
45 |
Require all granted |
15
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
46 |
AllowOverride None |
13
7ed40cd96e3a
Possible fix for: AH01630: client denied by server configuration.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
12
diff
changeset
|
47 |
</Directory> |
11
a6a75053c129
Fixed names, enabled debugging.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
10
diff
changeset
|
48 |
</VirtualHost> |
10
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
49 |
EOF |
6a6933bfce58
Added test Apache 2 virtual host.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
50 |
|
15
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
51 |
a2ensite hg |
3f7b202af99e
An attempt to host HG via Apache.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
13
diff
changeset
|
52 |
# service apache2 restart |