forked from paketo-buildpacks/httpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default_conf.go
86 lines (69 loc) · 2 KB
/
default_conf.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package httpd
const (
httpdConf = `ServerRoot "${SERVER_ROOT}"
ServerName "0.0.0.0"
LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule dir_module modules/mod_dir.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule unixd_module modules/mod_unixd.so
{{if or .WebServerPushStateEnabled .WebServerForceHTTPS -}}
LoadModule rewrite_module modules/mod_rewrite.so
{{end}}
{{- if .WebServerPushStateEnabled -}}
LoadModule autoindex_module modules/mod_autoindex.so
{{end}}
{{- if .BasicAuthFile -}}
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
{{end}}
TypesConfig conf/mime.types
PidFile /tmp/httpd.pid
User nobody
Listen "${PORT}"
DocumentRoot "{{.WebServerRoot}}"
DirectoryIndex index.html
ErrorLog /proc/self/fd/2
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog /proc/self/fd/1 common
<Directory />
AllowOverride None
Require all denied
</Directory>
<Directory "{{.WebServerRoot}}">
{{- if .BasicAuthFile}}
Require valid-user
{{- else}}
Require all granted
{{- end}}
{{- if .WebServerPushStateEnabled}}
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html
{{- end}}
{{- if .WebServerForceHTTPS}}
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
{{- end}}
{{- if .BasicAuthFile}}
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "{{.BasicAuthFile}}"
Order allow,deny
Allow from all
{{- end}}
</Directory>
<Files ".ht*">
Require all denied
</Files>`
)