mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat(nginx): performance optimization #850
This commit is contained in:
parent
b59da3e7e8
commit
9d4070a211
29 changed files with 4250 additions and 2031 deletions
36
api/nginx/performance.go
Normal file
36
api/nginx/performance.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
package nginx
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/uozi-tech/cosy"
|
||||
)
|
||||
|
||||
// GetPerformanceSettings retrieves current Nginx performance settings
|
||||
func GetPerformanceSettings(c *gin.Context) {
|
||||
// Get Nginx worker configuration info
|
||||
perfInfo, err := nginx.GetNginxWorkerConfigInfo()
|
||||
if err != nil {
|
||||
cosy.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, perfInfo)
|
||||
}
|
||||
|
||||
// UpdatePerformanceSettings updates Nginx performance settings
|
||||
func UpdatePerformanceSettings(c *gin.Context) {
|
||||
var perfOpt nginx.PerfOpt
|
||||
if !cosy.BindAndValid(c, &perfOpt) {
|
||||
return
|
||||
}
|
||||
|
||||
err := nginx.UpdatePerfOpt(&perfOpt)
|
||||
if err != nil {
|
||||
cosy.ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
GetPerformanceSettings(c)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue