diff --git a/plugins/apache/conf/httpd-mpm.conf b/plugins/apache/conf/httpd-mpm.conf new file mode 100644 index 000000000..fb273eecc --- /dev/null +++ b/plugins/apache/conf/httpd-mpm.conf @@ -0,0 +1,57 @@ + + PidFile "logs/httpd.pid" + + + + StartServers 5 + MinSpareServers 5 + MaxSpareServers 10 + MaxRequestWorkers 250 + MaxConnectionsPerChild 0 + + + + StartServers 3 + MinSpareThreads 75 + MaxSpareThreads 250 + ThreadsPerChild 25 + MaxRequestWorkers 400 + MaxConnectionsPerChild 0 + + + + StartServers 3 + MinSpareThreads 75 + MaxSpareThreads 250 + ThreadsPerChild 25 + MaxRequestWorkers 400 + MaxConnectionsPerChild 0 + + + + ThreadStackSize 65536 + StartThreads 250 + MinSpareThreads 25 + MaxSpareThreads 250 + MaxThreads 1000 + MaxConnectionsPerChild 0 + + + + StartServers 2 + MinSpareThreads 5 + MaxSpareThreads 10 + MaxConnectionsPerChild 0 + + + + ThreadsPerChild 150 + MaxConnectionsPerChild 0 + + + + MaxMemFree 2048 + + + MaxMemFree 100 + diff --git a/plugins/apache/conf/httpd.conf b/plugins/apache/conf/httpd.conf index 466a881f1..297a8ba3a 100644 --- a/plugins/apache/conf/httpd.conf +++ b/plugins/apache/conf/httpd.conf @@ -32,6 +32,7 @@ Group daemon ServerAdmin you@example.com +ServerName localhost:8280 AllowOverride none diff --git a/plugins/apache/index.py b/plugins/apache/index.py index 58cf66e1e..925d33983 100755 --- a/plugins/apache/index.py +++ b/plugins/apache/index.py @@ -71,7 +71,6 @@ def checkArgs(data, ck=[]): def clearTemp(): path_bin = getServerDir() + "/httpd" - mw.execShell('rm -rf ' + path_bin + '/client_body_temp') def getConf(): @@ -481,8 +480,7 @@ def setCfg(): args = getArgs() # 检查参数,允许动态参数 - - cfg = getConf() + cfg = getConfMpm() mw.backFile(cfg) content = mw.readFile(cfg) @@ -512,7 +510,7 @@ def setCfg(): content = re.sub(rep, newconf, content) mw.writeFile(cfg, content) - isError = mw.checkWebConfig() + isError = mw.checkHttpdConfig() if (isError != True): mw.restoreFile(cfg) return mw.returnJson(False, 'ERROR: 配置出错
' + isError.replace("\n", '
') + '
') diff --git a/web/core/mw.py b/web/core/mw.py index f588db225..e208b9797 100644 --- a/web/core/mw.py +++ b/web/core/mw.py @@ -1463,7 +1463,19 @@ def checkWebConfig(): result = execShell(cmd) searchStr = 'test is successful' if result[1].find(searchStr) == -1: - msg = getInfo('配置文件错误: {1}', (result[1],)) + msg = getInfo('配置文件错误[openresty]: {1}', (result[1],)) + writeLog("软件管理", msg) + return result[1] + return True + +def checkHttpdConfig(): + op_dir = getServerDir() + '/apache/httpd' + # "ulimit -n 10240 && " + + cmd = op_dir + "/bin/httpd -t" + result = execShell(cmd) + searchStr = 'Syntax OK' + if result[1].find(searchStr) == -1: + msg = getInfo('配置文件错误[httpd]: {1}', (result[1],)) writeLog("软件管理", msg) return result[1] return True