2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-05 05:47:17 +08:00

特性(全局):增强安全性

This commit is contained in:
耗子
2022-12-10 13:16:31 +08:00
parent d4de5c6697
commit f91d079296
15 changed files with 306 additions and 119 deletions

View File

@@ -107,11 +107,12 @@ class SettingsController extends Controller
return response()->json($res);
}
if ($port != $matches[1]) {
$nginxConf = preg_replace('/listen\s+(\d+)/', 'listen '.$port, $nginxConf);
$nginxConf = preg_replace('/listen\s+'.$matches[1].'/', 'listen '.$port, $nginxConf, 1);
file_put_contents('/www/server/nginx/conf/nginx.conf', $nginxConf);
// 重载nginx
shell_exec('systemctl reload nginx');
// 防火墙放行端口
$port = escapeshellarg($port);
shell_exec('firewall-cmd --permanent --zone=public --add-port='.$port.'/tcp >/dev/null 2>&1');
shell_exec('firewall-cmd --reload');
}