comparison deploy/config/code-ssl.conf.in @ 1601:07deb8466f65 deploy

More provisioning docs/tweaks
author Chris Cannam
date Thu, 24 Aug 2017 14:25:03 +0100
parents
children 18643ab36008
comparison
equal deleted inserted replaced
1600:ed9c467ef922 1601:07deb8466f65
1
2 # Apache config with SSL and admin auth stubbed in. You must provide
3 # the key/cert and auth files.
4
5 # Note this has been updated for Apache 2.4, which introduced a number
6 # of (welcome) changes to access control directives.
7
8 PerlLoadModule Apache::Authn::SoundSoftware
9
10 <VirtualHost *:80>
11 ServerName code.soundsoftware.ac.uk
12 ServerAdmin chris.cannam@soundsoftware.ac.uk
13
14 DocumentRoot /var/www/code/public
15 PassengerRestartDir restart_files
16 PassengerHighPerformance on
17 PassengerMaxRequests 50000
18 PassengerStatThrottleRate 5
19 PassengerFriendlyErrorPages off
20 RailsSpawnMethod smart
21 ExpiresDefault "access plus 1 minute"
22
23 # Redirect all activity to secure site
24 Redirect seeother / "https://code.soundsoftware.ac.uk/"
25
26 <DirectoryMatch "^/.*/\.svn/">
27 Require all denied
28 </DirectoryMatch>
29
30 <DirectoryMatch "^/.*/\.hg/">
31 Require all denied
32 </DirectoryMatch>
33
34 <DirectoryMatch "^/.*/\.git/">
35 Require all denied
36 </DirectoryMatch>
37
38 <Directory /var/www/code/public>
39 Options -MultiViews
40 </Directory>
41
42 ErrorLog /var/log/apache2/code-error.log
43 CustomLog /var/log/apache2/code-access.log vhost_combined
44
45 LogLevel warn
46 ServerSignature Off
47 </VirtualHost>
48
49 <VirtualHost *:80>
50 ServerName code.soundsoftware.ac.uk
51 ServerAdmin chris.cannam@soundsoftware.ac.uk
52
53 DocumentRoot /var/www/code/public
54 PassengerRestartDir restart_files
55 PassengerHighPerformance on
56 PassengerMaxRequests 50000
57 PassengerStatThrottleRate 5
58 PassengerStartTimeout 60
59 PassengerFriendlyErrorPages off
60 RailsSpawnMethod smart
61 ExpiresDefault "access plus 1 minute"
62
63 <Location /sys>
64 AuthType Basic
65 AuthUserFile "/etc/apache2/auth/user.htpasswd"
66 AuthName "code.soundsoftware.ac.uk"
67 Require user user
68 </Location>
69
70 <Location /admin>
71 AuthType Digest
72 AuthUserFile "/etc/apache2/auth/admin.htdigest"
73 AuthName "code.soundsoftware.ac.uk admin interface"
74 Require user admin
75 </Location>
76
77 <DirectoryMatch "^/.*/\.svn/">
78 Require all denied
79 </DirectoryMatch>
80
81 <DirectoryMatch "^/.*/\.hg/">
82 Require all denied
83 </DirectoryMatch>
84
85 <DirectoryMatch "^/.*/\.git/">
86 Require all denied
87 </DirectoryMatch>
88
89 <Directory /var/www/code/public>
90 Options -MultiViews
91 </Directory>
92
93 <Directory /var/www/code/public/themes/soundsoftware/stylesheets/fonts>
94 # Avoid other sites embedding our fonts
95 RewriteEngine on
96 RewriteCond %{HTTP_REFERER} !^$
97 RewriteCond %{HTTP_REFERER} !^http(s)?://code.soundsoftware.ac.uk/.*$ [NC]
98 RewriteRule \.(ttf|woff|eot|otf|svg|zip|gz|html|txt)$ - [F]
99 </Directory>
100
101 ScriptAlias /hg "/var/hg/index.cgi"
102
103 <Location /hg>
104 AuthName "Mercurial"
105 AuthType Basic
106 Require valid-user
107 PerlAccessHandler Apache::Authn::SoundSoftware::access_handler
108 PerlAuthenHandler Apache::Authn::SoundSoftware::authen_handler
109 PerlSetVar HTTPS "on"
110 SoundSoftwareDSN "dbi:Pg:database=code;host=localhost"
111 SoundSoftwareDbUser "code"
112 SoundSoftwareDbPass "INSERT_DATABASE_PASSWORD_HERE"
113 SoundSoftwareRepoPrefix "/var/hg/"
114 SoundSoftwareSslRequired "on"
115 Options +ExecCGI
116 AddHandler cgi-script .cgi
117 ExpiresDefault now
118 </Location>
119
120 Alias /git "/var/files/git-mirror"
121
122 <Directory "/var/files/git-mirror">
123 Options -Indexes +FollowSymLinks
124 Require all granted
125 </Directory>
126 <Directory ~ "/var/files/git-mirror/.*\.workdir">
127 Require all denied
128 </Directory>
129 <Directory ~ "/var/files/git-mirror/__.*">
130 Require all denied
131 </Directory>
132
133 ErrorLog /var/log/apache2/code-error.log
134 CustomLog /var/log/apache2/code-access.log vhost_combined
135
136 LogLevel warn
137 ServerSignature Off
138
139 </VirtualHost>
140