From 9fe362fff151bffe723507965db473b90fd3258c Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 8 Dec 2018 15:47:40 +0800 Subject: [PATCH] Update index.py --- plugins/openresty/index.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 92673f0c5..0e69b7310 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -68,28 +68,35 @@ def confReplace(): content = public.readFile(getConf()) content = content.replace('{$SERVER_PATH}', service_path) + user = 'www' + user_group = 'www' # macosx do if public.getOs() == 'darwin': user = public.execShell( "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() - user_group = 'root' - content = content.replace('{$OS_USER}', 'root') - content = content.replace('{$OS_USER_GROUP}', user_group) - + # user = 'root' + user_group = 'staff' content = content.replace('{$EVENT_MODEL}', 'kqueue') else: - content = content.replace('{$OS_USER}', 'www') - content = content.replace('{$OS_USER_GROUP}', 'www') + user = 'www' + user_group = 'www' content = content.replace('{$EVENT_MODEL}', 'epoll') - exe_bin = getServerDir() + "/bin/openresty" - # exe_bin = getServerDir() + "/nginx/sbin/nginx" - public.execShell('chown root:root ' + exe_bin) - public.execShell('chmod 755 ' + exe_bin) - public.execShell('chmod u+s ' + exe_bin) + content = content.replace('{$OS_USER}', user) + content = content.replace('{$OS_USER_GROUP}', user_group) public.writeFile(getServerDir() + '/nginx/conf/nginx.conf', content) + exe_bin = getServerDir() + "/bin/openresty" + print public.execShell('chown -R ' + user + ':' + user_group + ' ' + exe_bin) + print public.execShell('chmod 755 ' + exe_bin) + print public.execShell('chmod u+s ' + exe_bin) + + nginx_exe_bin = getServerDir() + "/nginx/sbin/nginx" + print public.execShell('chown -R ' + user + ':' + user_group + ' ' + nginx_exe_bin) + print public.execShell('chmod 755 ' + nginx_exe_bin) + print public.execShell('chmod u+s ' + nginx_exe_bin) + def initDreplace():