From 0ad6947a31425b10d40cd92ff49f1c6986b0f374 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 8 Dec 2018 14:43:32 +0800 Subject: [PATCH] update --- plugins/openresty/conf/nginx.conf | 2 +- plugins/openresty/conf/nginx_status.conf | 9 +++++++++ plugins/openresty/index.py | 19 +++++++++++++++++-- plugins/openresty/versions/1.11.2/install.sh | 3 ++- plugins/openresty/versions/1.13.6/install.sh | 3 ++- 5 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 plugins/openresty/conf/nginx_status.conf diff --git a/plugins/openresty/conf/nginx.conf b/plugins/openresty/conf/nginx.conf index bc98c0b6e..b2740bcd2 100644 --- a/plugins/openresty/conf/nginx.conf +++ b/plugins/openresty/conf/nginx.conf @@ -85,6 +85,6 @@ http access_log {$SERVER_PATH}/openresty/nginx/logs/access.log; } - include {$SERVER_PATH}/mdserver-web/vhost/nginx/*.conf; + include {$SERVER_PATH}/openresty/nginx/conf/vhost/*.conf; } diff --git a/plugins/openresty/conf/nginx_status.conf b/plugins/openresty/conf/nginx_status.conf new file mode 100644 index 000000000..e8dd05cef --- /dev/null +++ b/plugins/openresty/conf/nginx_status.conf @@ -0,0 +1,9 @@ +server { + listen 80; + server_name 127.0.0.1; + allow 127.0.0.1; + location /nginx_status { + stub_status on; + access_log off; + } +} diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 990ee580b..92673f0c5 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -51,6 +51,18 @@ def getInitDTpl(): return path +def makeConf(): + import shutil + vhost = getServerDir() + '/nginx/conf/vhost' + if not os.path.exists(vhost): + os.mkdir(vhost) + + source_vhost = getPluginDir() + '/conf/nginx_status.conf' + dest_vhost = vhost + '/nginx_status.conf' + # if not os.path.exists(dest_vhost): + shutil.copyfile(source_vhost, dest_vhost) + + def confReplace(): service_path = os.path.dirname(os.getcwd()) content = public.readFile(getConf()) @@ -61,7 +73,7 @@ def confReplace(): user = public.execShell( "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() user_group = 'root' - content = content.replace('{$OS_USER}', user) + content = content.replace('{$OS_USER}', 'root') content = content.replace('{$OS_USER_GROUP}', user_group) content = content.replace('{$EVENT_MODEL}', 'kqueue') @@ -72,7 +84,7 @@ def confReplace(): exe_bin = getServerDir() + "/bin/openresty" # exe_bin = getServerDir() + "/nginx/sbin/nginx" - public.execShell('chown midoks:root ' + exe_bin) + public.execShell('chown root:root ' + exe_bin) public.execShell('chmod 755 ' + exe_bin) public.execShell('chmod u+s ' + exe_bin) @@ -98,6 +110,9 @@ def initDreplace(): # config replace confReplace() + # make nginx vhost or other + makeConf() + return file_bin diff --git a/plugins/openresty/versions/1.11.2/install.sh b/plugins/openresty/versions/1.11.2/install.sh index d0e225e04..225bb0406 100755 --- a/plugins/openresty/versions/1.11.2/install.sh +++ b/plugins/openresty/versions/1.11.2/install.sh @@ -24,7 +24,8 @@ Install_openresty() cd ${openrestyDir} && tar -zxvf openresty-1.11.2.5.tar.gz cd ${openrestyDir}/openresty-1.11.2.5 && ./configure --prefix=$serverPath/openresty \ - --with-openssl=$serverPath/source/lib/openssl-1.0.2q && make && make install && \ + --with-openssl=$serverPath/source/lib/openssl-1.0.2q \ + --with-http_stub_status_module && make && make install && \ echo '1.11.2' > $serverPath/openresty/version.pl diff --git a/plugins/openresty/versions/1.13.6/install.sh b/plugins/openresty/versions/1.13.6/install.sh index d14265b5b..3752ddbe9 100755 --- a/plugins/openresty/versions/1.13.6/install.sh +++ b/plugins/openresty/versions/1.13.6/install.sh @@ -23,7 +23,8 @@ Install_openresty() cd ${openrestyDir} && tar -zxvf openresty-1.13.6.2.tar.gz cd ${openrestyDir}/openresty-1.13.6.2 && ./configure --prefix=$serverPath/openresty \ - --with-openssl=$serverPath/source/lib/openssl-1.0.2q && make && make install && \ + --with-openssl=$serverPath/source/lib/openssl-1.0.2q \ + --with-http_stub_status_module && make && make install && \ echo '1.13.6' > $serverPath/openresty/version.pl echo '安装完成' > $install_tmp