nginx

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDefaultVhost added in v0.6.0

func EnsureDefaultVhost() error

EnsureDefaultVhost writes a catch-all default server that returns 444 for any request that doesn't match a registered site. This prevents nginx from falling back to the first alphabetical vhost for unknown hostnames.

func EnsureNginxConfig

func EnsureNginxConfig() error

EnsureNginxConfig copies the base nginx.conf to the data dir if it is missing.

func GeneratePausedVhost added in v1.0.0

func GeneratePausedVhost(site config.Site) error

GeneratePausedVhost writes a minimal nginx vhost that serves the static paused landing page for the given site. For secured sites it also adds the HTTPS block so the redirect and TLS still work while the site is paused.

func GeneratePausedWorktreeVhost added in v1.0.1

func GeneratePausedWorktreeVhost(domain, certDomain, pausedDir string, secured bool) error

GeneratePausedWorktreeVhost writes a paused nginx vhost for a worktree domain. certDomain is the parent site's domain whose cert files back the wildcard.

func GenerateProxyVhost added in v0.1.21

func GenerateProxyVhost(domain, upstreamHost string, upstreamPort int) error

GenerateProxyVhost renders vhost-proxy.conf.tmpl and writes conf.d/{domain}.conf.

func GenerateSSLVhost

func GenerateSSLVhost(site config.Site, phpVersion string) error

GenerateSSLVhost renders the SSL vhost template and writes it to conf.d.

func GenerateVhost

func GenerateVhost(site config.Site, phpVersion string) error

GenerateVhost renders the HTTP vhost template and writes it to conf.d.

func GenerateWorktreeSSLVhost added in v0.6.0

func GenerateWorktreeSSLVhost(domain, path, phpVersion, parentDomain string) error

GenerateWorktreeSSLVhost renders the SSL vhost template for a worktree checkout, reusing the parent site's wildcard certificate (*.parentDomain).

func GenerateWorktreeVhost added in v0.6.0

func GenerateWorktreeVhost(domain, path, phpVersion string) error

GenerateWorktreeVhost renders the HTTP vhost template for a worktree checkout and writes it to conf.d/<domain>.conf.

func GetTemplate

func GetTemplate(name string) ([]byte, error)

GetTemplate returns the content of a named nginx template/config file. name can be "nginx.conf", "vhost.conf.tmpl", or "vhost-ssl.conf.tmpl".

func Reload

func Reload() error

Reload signals nginx to reload its configuration.

func RemoveVhost

func RemoveVhost(domain string) error

RemoveVhost deletes the vhost config files for the given domain.

Types

type VhostData

type VhostData struct {
	Domain          string
	Path            string
	PHPVersion      string
	PHPVersionShort string
	CertDomain      string // domain whose cert files to use (defaults to Domain)
	PublicDir       string // document root subdirectory, e.g. "public", "web", "."
	Reverb          bool   // true when the site uses Laravel Reverb (adds /app WebSocket proxy)
}

VhostData is the data passed to vhost templates.

Jump to

Keyboard shortcuts

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