nginx

package
v0.1.0-beta1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

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

type Nginx

type Nginx struct{}

func (Nginx) GenerateConfig

func (n Nginx) GenerateConfig(path string, template interface{}) error

func (Nginx) RemoveConfig

func (n Nginx) RemoveConfig(path string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL