Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TplNginxConf = template.Must(template.New("").Parse(`
{{range $upstream := .Upstreams}}
upstream {{$upstream.Name}} {
server {{$upstream.Address}};
}
{{end}}
server {
{{if eq .Server.Protocol "http"}}
listen {{.Server.Port}};
{{else if eq .Server.Protocol "https"}}
listen {{.Server.Port}} ssl;{{end}}
server_name {{.Server.Hostname}};
{{if eq .Server.Protocol "https"}}
ssl on;
ssl_certificate {{.RootPath}}/ssl/server.crt;
ssl_certificate_key {{.RootPath}}/ssl/server.key;
{{end}}
{{range $location := .Server.Locations}}
location {{$location.Path}} {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass {{$location.ProxyPass}};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
}
{{end}}
}
`))
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.