mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat(docker): mkdir streams-enabled, streams-available
This commit is contained in:
parent
9bd1507392
commit
070c0b4620
2 changed files with 12 additions and 1 deletions
|
@ -3,8 +3,11 @@ package nginx
|
|||
import (
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
"os/exec"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var mutex sync.Mutex
|
||||
|
||||
func execShell(cmd string) (out string) {
|
||||
bytes, err := exec.Command("/bin/sh", "-c", cmd).CombinedOutput()
|
||||
out = string(bytes)
|
||||
|
@ -24,6 +27,8 @@ func execCommand(name string, cmd ...string) (out string) {
|
|||
}
|
||||
|
||||
func TestConf() (out string) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
if settings.NginxSettings.TestConfigCmd != "" {
|
||||
out = execShell(settings.NginxSettings.TestConfigCmd)
|
||||
|
||||
|
@ -36,6 +41,8 @@ func TestConf() (out string) {
|
|||
}
|
||||
|
||||
func Reload() (out string) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
if settings.NginxSettings.ReloadCmd != "" {
|
||||
out = execShell(settings.NginxSettings.ReloadCmd)
|
||||
return
|
||||
|
@ -47,6 +54,8 @@ func Reload() (out string) {
|
|||
}
|
||||
|
||||
func Restart() (out string) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
if settings.NginxSettings.RestartCmd != "" {
|
||||
out = execShell(settings.NginxSettings.RestartCmd)
|
||||
|
||||
|
|
|
@ -5,11 +5,13 @@ error_log /var/log/nginx/error.log notice;
|
|||
error_log /var/log/nginx/error.local.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
stream {
|
||||
include /etc/nginx/streams-enabled/*.conf;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue