Chris@1570
|
1
|
Chris@1570
|
2 # A test Apache config. Lacks SSL, lacks a desirable extra layer of
|
Chris@1570
|
3 # authentication for admin interface paths. Do not deploy this.
|
Chris@1570
|
4
|
Chris@1593
|
5 # Note this has been updated for Apache 2.4, which introduced a number
|
Chris@1593
|
6 # of (welcome) changes to access control directives.
|
Chris@1593
|
7
|
Chris@1570
|
8 PerlLoadModule Apache::Authn::SoundSoftware
|
Chris@1570
|
9
|
Chris@1570
|
10 <VirtualHost *:80>
|
Chris@1570
|
11 ServerName code.soundsoftware.ac.uk
|
Chris@1570
|
12 ServerAdmin chris.cannam@soundsoftware.ac.uk
|
Chris@1570
|
13
|
Chris@1570
|
14 DocumentRoot /var/www/code/public
|
Chris@1570
|
15 PassengerRestartDir restart_files
|
Chris@1570
|
16 PassengerHighPerformance on
|
Chris@1570
|
17 PassengerMaxRequests 50000
|
Chris@1570
|
18 PassengerStatThrottleRate 5
|
Chris@1570
|
19 PassengerStartTimeout 60
|
Chris@1571
|
20 PassengerFriendlyErrorPages on
|
Chris@1570
|
21 RailsSpawnMethod smart
|
Chris@1570
|
22 ExpiresDefault "access plus 1 minute"
|
Chris@1570
|
23
|
Chris@1590
|
24 # <Location /sys>
|
Chris@1590
|
25 # AuthType Basic
|
Chris@1590
|
26 # AuthUserFile "/etc/apache2/auth/user.htpasswd"
|
Chris@1590
|
27 # AuthName "code.soundsoftware.ac.uk"
|
Chris@1590
|
28 # Require user user
|
Chris@1590
|
29 # </Location>
|
Chris@1590
|
30
|
Chris@1590
|
31 # <Location /admin>
|
Chris@1590
|
32 # AuthType Digest
|
Chris@1590
|
33 # AuthUserFile "/etc/apache2/auth/admin.htdigest"
|
Chris@1590
|
34 # AuthName "code.soundsoftware.ac.uk admin interface"
|
Chris@1590
|
35 # Require user admin
|
Chris@1590
|
36 # </Location>
|
Chris@1590
|
37
|
Chris@1570
|
38 <DirectoryMatch "^/.*/\.svn/">
|
Chris@1593
|
39 Require all denied
|
Chris@1570
|
40 </DirectoryMatch>
|
Chris@1570
|
41
|
Chris@1570
|
42 <DirectoryMatch "^/.*/\.hg/">
|
Chris@1593
|
43 Require all denied
|
Chris@1570
|
44 </DirectoryMatch>
|
Chris@1570
|
45
|
Chris@1570
|
46 <DirectoryMatch "^/.*/\.git/">
|
Chris@1593
|
47 Require all denied
|
Chris@1570
|
48 </DirectoryMatch>
|
Chris@1570
|
49
|
Chris@1570
|
50 <Directory /var/www/code/public>
|
Chris@1570
|
51 Options -MultiViews
|
Chris@1570
|
52 </Directory>
|
Chris@1570
|
53
|
Chris@1570
|
54 <Directory /var/www/code/public/themes/soundsoftware/stylesheets/fonts>
|
Chris@1570
|
55 # Avoid other sites embedding our fonts
|
Chris@1570
|
56 RewriteEngine on
|
Chris@1570
|
57 RewriteCond %{HTTP_REFERER} !^$
|
Chris@1570
|
58 RewriteCond %{HTTP_REFERER} !^http(s)?://code.soundsoftware.ac.uk/.*$ [NC]
|
Chris@1570
|
59 RewriteRule \.(ttf|woff|eot|otf|svg|zip|gz|html|txt)$ - [F]
|
Chris@1570
|
60 </Directory>
|
Chris@1570
|
61
|
Chris@1570
|
62 ScriptAlias /hg "/var/hg/index.cgi"
|
Chris@1570
|
63
|
Chris@1570
|
64 <Location /hg>
|
Chris@1570
|
65 AuthName "Mercurial"
|
Chris@1570
|
66 AuthType Basic
|
Chris@1570
|
67 Require valid-user
|
Chris@1570
|
68 PerlAccessHandler Apache::Authn::SoundSoftware::access_handler
|
Chris@1570
|
69 PerlAuthenHandler Apache::Authn::SoundSoftware::authen_handler
|
Chris@1601
|
70 PerlSetVar HTTPS "off"
|
Chris@1570
|
71 SoundSoftwareDSN "dbi:Pg:database=code;host=localhost"
|
Chris@1570
|
72 SoundSoftwareDbUser "code"
|
Chris@1593
|
73 SoundSoftwareDbPass "INSERT_DATABASE_PASSWORD_HERE"
|
Chris@1570
|
74 SoundSoftwareRepoPrefix "/var/hg/"
|
Chris@1576
|
75 #!!! "on" in production please!:
|
Chris@1576
|
76 SoundSoftwareSslRequired "off"
|
Chris@1570
|
77 Options +ExecCGI
|
Chris@1570
|
78 AddHandler cgi-script .cgi
|
Chris@1570
|
79 ExpiresDefault now
|
Chris@1570
|
80 </Location>
|
Chris@1570
|
81
|
Chris@1570
|
82 Alias /git "/var/files/git-mirror"
|
Chris@1570
|
83
|
Chris@1570
|
84 <Directory "/var/files/git-mirror">
|
Chris@1570
|
85 Options -Indexes +FollowSymLinks
|
Chris@1593
|
86 Require all granted
|
Chris@1570
|
87 </Directory>
|
Chris@1570
|
88 <Directory ~ "/var/files/git-mirror/.*\.workdir">
|
Chris@1593
|
89 Require all denied
|
Chris@1570
|
90 </Directory>
|
Chris@1570
|
91 <Directory ~ "/var/files/git-mirror/__.*">
|
Chris@1593
|
92 Require all denied
|
Chris@1570
|
93 </Directory>
|
Chris@1570
|
94
|
Chris@1570
|
95 ErrorLog /var/log/apache2/code-error.log
|
Chris@1570
|
96 CustomLog /var/log/apache2/code-access.log vhost_combined
|
Chris@1570
|
97
|
Chris@1570
|
98 LogLevel warn
|
Chris@1570
|
99 ServerSignature Off
|
Chris@1570
|
100
|
Chris@1570
|
101 </VirtualHost>
|
Chris@1570
|
102
|