diff --git a/plugins/openresty/conf/nginx.conf b/plugins/openresty/conf/nginx.conf index eb045f406..bc98c0b6e 100644 --- a/plugins/openresty/conf/nginx.conf +++ b/plugins/openresty/conf/nginx.conf @@ -1,15 +1,15 @@ user {$OS_USER} {$OS_USER_GROUP}; worker_processes auto; -error_log {$SERVER_PATH}/server/openresty/nginx/logs/nginx_error.log crit; -pid {$SERVER_PATH}/server/openresty/nginx/logs/nginx.pid; +error_log {$SERVER_PATH}/openresty/nginx/logs/error.log crit; +pid {$SERVER_PATH}/openresty/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events { - #use epoll; - worker_connections 51200; - multi_accept on; + use {$EVENT_MODEL}; + worker_connections 51200; + multi_accept on; } http @@ -60,7 +60,7 @@ http server { - listen 888; + listen 8088; server_name www.bt.cn; index index.html index.htm index.php; root /www/server/phpmyadmin; @@ -83,8 +83,8 @@ http deny all; } - access_log /www/wwwlogs/access.log; + access_log {$SERVER_PATH}/openresty/nginx/logs/access.log; } - include /www/server/panel/vhost/nginx/*.conf; + include {$SERVER_PATH}/mdserver-web/vhost/nginx/*.conf; } diff --git a/plugins/openresty/index.py b/plugins/openresty/index.py index 27a2411b8..990ee580b 100755 --- a/plugins/openresty/index.py +++ b/plugins/openresty/index.py @@ -32,6 +32,15 @@ def getInitDFile(): return '/etc/init.d/' + getPluginName() +def clearTemp(): + path_bin = getServerDir() + "/nginx" + public.execShell('rm -rf ' + path_bin + '/client_body_temp') + public.execShell('rm -rf ' + path_bin + '/fastcgi_temp') + public.execShell('rm -rf ' + path_bin + '/proxy_temp') + public.execShell('rm -rf ' + path_bin + '/scgi_temp') + public.execShell('rm -rf ' + path_bin + '/uwsgi_temp') + + def getConf(): path = getPluginDir() + "/conf/nginx.conf" return path @@ -51,12 +60,21 @@ def confReplace(): if public.getOs() == 'darwin': user = public.execShell( "who | sed -n '2, 1p' |awk '{print $1}'")[0].strip() - user_group = 'staff' + user_group = 'root' content = content.replace('{$OS_USER}', user) content = content.replace('{$OS_USER_GROUP}', user_group) + + content = content.replace('{$EVENT_MODEL}', 'kqueue') else: content = content.replace('{$OS_USER}', 'www') content = content.replace('{$OS_USER_GROUP}', 'www') + content = content.replace('{$EVENT_MODEL}', 'epoll') + + exe_bin = getServerDir() + "/bin/openresty" + # exe_bin = getServerDir() + "/nginx/sbin/nginx" + public.execShell('chown midoks:root ' + exe_bin) + public.execShell('chmod 755 ' + exe_bin) + public.execShell('chmod u+s ' + exe_bin) public.writeFile(getServerDir() + '/nginx/conf/nginx.conf', content) @@ -103,6 +121,8 @@ def start(): def stop(): file = initDreplace() data = public.execShell(file + ' stop') + print data + clearTemp() if data[1] == '': return 'ok' return 'fail' @@ -167,6 +187,8 @@ if __name__ == "__main__": print start() elif func == 'stop': print stop() + elif func == 'restart': + print restart() elif func == 'reload': print reload() elif func == 'initd_status': diff --git a/vhost/nginx/phpfpm_status.conf b/vhost/nginx/phpfpm_status.conf index 96fbb8209..8b1378917 100644 --- a/vhost/nginx/phpfpm_status.conf +++ b/vhost/nginx/phpfpm_status.conf @@ -1,49 +1 @@ -server { - listen 80; - server_name 127.0.0.1; - allow 127.0.0.1; - location /nginx_status { - stub_status on; - access_log off; - } - location /phpfpm_52_status { - fastcgi_pass unix:/tmp/php-cgi-52.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } - location /phpfpm_53_status { - fastcgi_pass unix:/tmp/php-cgi-53.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } - location /phpfpm_54_status { - fastcgi_pass unix:/tmp/php-cgi-54.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } - location /phpfpm_55_status { - fastcgi_pass unix:/tmp/php-cgi-55.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } - location /phpfpm_56_status { - fastcgi_pass unix:/tmp/php-cgi-56.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } - location /phpfpm_70_status { - fastcgi_pass unix:/tmp/php-cgi-70.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } - location /phpfpm_71_status { - fastcgi_pass unix:/tmp/php-cgi-71.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } - location /phpfpm_72_status { - fastcgi_pass unix:/tmp/php-cgi-72.sock; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; - } -} +