mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-11-20 00:01:06 +00:00
* feat(openresty): add proxy timeout settings to performance tuning Expose proxy_connect_timeout, proxy_send_timeout and proxy_read_timeout at http level, so a slow backend no longer hits the 60s 504 without a way to raise it from the panel. The stock nginx.conf does not set them, so an absent directive is shown with nginx's built-in 60s and only written once changed. Writing it unconditionally would clash with the same directive set at http level by an included file and fail the config test. Time directives now keep their unit suffix like the size directives do. keepalive_timeout previously dropped it, saving 5m back as 5 seconds, and its helper text no longer reads as a generic connection timeout. Refs #13824 * fix(openresty): keep performance settings from overwriting http-level values Reading the http scope used FindDirectives, which descends into server and location blocks, while saving writes the http block. A site-level proxy_read_timeout 2s was shown as the global value and written back over the global 5m when only gzip was changed. Read only the http block's own directives. A directive nginx.conf leaves unset may still be set at the top level of an included file. Report that value with its file, show it read-only, and leave it out of the save, instead of showing nginx's default and writing a duplicate that fails the config test. Durations are now edited as written and only sent when changed, so 1m30s and keepalive_timeout's second value round-trip intact. Input is validated against nginx's duration syntax. Saving is disabled until the current values have loaded, so the form defaults cannot be written over the real configuration.
115 lines
3.9 KiB
Go
115 lines
3.9 KiB
Go
package response
|
|
|
|
import "github.com/1Panel-dev/1Panel/agent/app/dto"
|
|
|
|
type NginxStatus struct {
|
|
Active int `json:"active"`
|
|
Accepts int `json:"accepts"`
|
|
Handled int `json:"handled"`
|
|
Requests int `json:"requests"`
|
|
Reading int `json:"reading"`
|
|
Writing int `json:"writing"`
|
|
Waiting int `json:"waiting"`
|
|
}
|
|
|
|
type NginxParam struct {
|
|
Name string `json:"name"`
|
|
Params []string `json:"params"`
|
|
// Source is the included file that sets an http-level directive missing
|
|
// from nginx.conf. Empty when the value comes from nginx.conf itself.
|
|
Source string `json:"source,omitempty"`
|
|
}
|
|
|
|
// NginxBrotliRes carries the brotli settings together with where they live.
|
|
// ManagedExternally is true when the user defined brotli by hand, in which
|
|
// case the panel only reports the values and must not write its own copy.
|
|
// ManagedPending is true when nginx does not load the managed configuration
|
|
// yet but saving will wire it in, so the reported values are not in effect
|
|
// until then.
|
|
// ManagedUnavailable is true when the panel cannot wire the managed
|
|
// configuration into nginx.conf at all, so the reported values are inert.
|
|
type NginxBrotliRes struct {
|
|
Params []NginxParam `json:"params"`
|
|
ManagedExternally bool `json:"managedExternally"`
|
|
ManagedPending bool `json:"managedPending"`
|
|
ManagedUnavailable bool `json:"managedUnavailable"`
|
|
}
|
|
|
|
type NginxAuthRes struct {
|
|
Enable bool `json:"enable"`
|
|
Items []dto.NginxAuth `json:"items"`
|
|
}
|
|
|
|
type NginxPathAuthRes struct {
|
|
dto.NginxPathAuth
|
|
}
|
|
|
|
type NginxAntiLeechRes struct {
|
|
Enable bool `json:"enable"`
|
|
Extends string `json:"extends"`
|
|
Return string `json:"return"`
|
|
ServerNames []string `json:"serverNames"`
|
|
Cache bool `json:"cache"`
|
|
CacheTime int `json:"cacheTime"`
|
|
CacheUint string `json:"cacheUint"`
|
|
NoneRef bool `json:"noneRef"`
|
|
LogEnable bool `json:"logEnable"`
|
|
Blocked bool `json:"blocked"`
|
|
}
|
|
|
|
type NginxRedirectConfig struct {
|
|
WebsiteID uint `json:"websiteID"`
|
|
Name string `json:"name"`
|
|
Domains []string `json:"domains"`
|
|
KeepPath bool `json:"keepPath"`
|
|
Enable bool `json:"enable"`
|
|
Type string `json:"type"`
|
|
Redirect string `json:"redirect"`
|
|
Path string `json:"path"`
|
|
Target string `json:"target"`
|
|
FilePath string `json:"filePath"`
|
|
Content string `json:"content"`
|
|
RedirectRoot bool `json:"redirectRoot"`
|
|
}
|
|
|
|
type NginxFile struct {
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
type NginxProxyCache struct {
|
|
Open bool `json:"open"`
|
|
CacheLimit float64 `json:"cacheLimit"`
|
|
CacheLimitUnit string `json:"cacheLimitUnit" `
|
|
ShareCache int `json:"shareCache" `
|
|
ShareCacheUnit string `json:"shareCacheUnit" `
|
|
CacheExpire int `json:"cacheExpire" `
|
|
CacheExpireUnit string `json:"cacheExpireUnit" `
|
|
}
|
|
|
|
type NginxModule struct {
|
|
Name string `json:"name"`
|
|
Custom bool `json:"custom"`
|
|
Script string `json:"script"`
|
|
Packages string `json:"packages"`
|
|
Params string `json:"params"`
|
|
Enable bool `json:"enable"`
|
|
BuildMode string `json:"buildMode"`
|
|
Provider string `json:"provider"`
|
|
LoadOrder int `json:"loadOrder"`
|
|
BuildStatus string `json:"buildStatus"`
|
|
LoadStatus string `json:"loadStatus"`
|
|
Artifacts []dto.NginxModuleArtifact `json:"artifacts"`
|
|
LastError string `json:"lastError"`
|
|
}
|
|
|
|
type NginxBuildConfig struct {
|
|
Mirror string `json:"mirror"`
|
|
DynamicSupported bool `json:"dynamicSupported"`
|
|
Modules []NginxModule `json:"modules"`
|
|
}
|
|
|
|
type NginxConfigRes struct {
|
|
Https bool `json:"https"`
|
|
SSLRejectHandshake bool `json:"sslRejectHandshake"`
|
|
}
|