summaryrefslogtreecommitdiff
path: root/templates/server.tmpl
blob: 38641b58242b8f446150482808dc86811cbbdaf3 (plain)
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
{{if .UpstreamName}}upstream {{.UpstreamName}} {
	{{range .Upstream}}server {{.}};
	{{end}}
}
{{end}}
server {
	listen 			{{.Port}};
	{{if .SSL}}listen 			{{.PortSSL}} ssl {{.SPDY}};{{end}}
	root 			{{.Root}};

	server_name 		{{range .ServerName}}{{.}} {{end}};
	index			{{range .Index}}{{.}} {{end}};
	
	{{if .AccessLog}}access_log 		{{.AccessLog}};{{end}}
	{{if .ErrorLog}}error_log 		{{.ErrorLog}};{{end}}

	# Settings for TLS
	{{if .SSL}}ssl_certificate 	{{.SSL_Cert}};
	ssl_certificate_key 	{{.SSL_Cert_Key}};
	{{template "ssl.tmpl" .}}{{else}}# Empty{{end}}

	# Basic PHP configuration
	{{if .UsePHP}}location ~ \.php$ {
		include  snippets/fastcgi-php.conf;
		{{if not .PHP_TCP}}fastcgi_pass unix:/var/run/php5-fpm.sock;{{end}}
	}{{else}}# Empty{{end}}

	# Disallow crawlers
	{{if .Robots}}{{template "robots.tmpl" .}}{{else}}# Empty{{end}}

	# Cache static content
	{{if .Cache_Static}}{{template "cache_static.tmpl" .}}{{else}}# Empty{{end}}

	# Google Pagespeed settings
	{{if .Pagespeed}}{{template "pagespeed.tmpl" .}}{{else}}# Empty{{end}}

	# Disallow Facebook to crawl your sites
	{{if .Block_Facebook}}{{template "block_facebook.tmpl" .}}{{else}}# Empty{{end}}

	location / {
		try_files $uri $uri/{{if .UsePHP}} /index.php?$args{{end}};
	}
}