mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -66,6 +66,7 @@ http
|
||||
stub_status on;
|
||||
access_log off;
|
||||
}
|
||||
include {$SERVER_PATH}/openresty/nginx/conf/php_status/*.conf;
|
||||
}
|
||||
include {$SERVER_PATH}/openresty/nginx/conf/vhost/*.conf;
|
||||
}
|
||||
|
||||
+10
-10
@@ -11,7 +11,8 @@ import public
|
||||
|
||||
|
||||
app_debug = False
|
||||
if public.getOs() == 'darwin':
|
||||
|
||||
if public.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
@@ -81,10 +82,12 @@ def getInitDTpl():
|
||||
|
||||
|
||||
def makeConf():
|
||||
import shutil
|
||||
vhost = getServerDir() + '/nginx/conf/vhost'
|
||||
if not os.path.exists(vhost):
|
||||
os.mkdir(vhost)
|
||||
php_status = getServerDir() + '/nginx/conf/php_status'
|
||||
if not os.path.exists(php_status):
|
||||
os.mkdir(php_status)
|
||||
|
||||
|
||||
def getFileOwner(filename):
|
||||
@@ -195,7 +198,7 @@ def restart():
|
||||
data = public.execShell(file + ' restart')
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
return data[1]
|
||||
|
||||
|
||||
def reload():
|
||||
@@ -208,8 +211,7 @@ def reload():
|
||||
|
||||
def initdStatus():
|
||||
if not app_debug:
|
||||
os_name = public.getOs()
|
||||
if os_name == 'darwin':
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
initd_bin = getInitDFile()
|
||||
if os.path.exists(initd_bin):
|
||||
@@ -220,8 +222,7 @@ def initdStatus():
|
||||
def initdInstall():
|
||||
import shutil
|
||||
if not app_debug:
|
||||
os_name = public.getOs()
|
||||
if os_name == 'darwin':
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
source_bin = initDreplace()
|
||||
@@ -233,8 +234,7 @@ def initdInstall():
|
||||
|
||||
def initdUinstall():
|
||||
if not app_debug:
|
||||
os_name = public.getOs()
|
||||
if os_name == 'darwin':
|
||||
if public.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
initd_bin = getInitDFile()
|
||||
os.remove(initd_bin)
|
||||
@@ -244,7 +244,7 @@ def initdUinstall():
|
||||
def runInfo():
|
||||
# 取Openresty负载状态
|
||||
try:
|
||||
result = public.httpGet('http://127.0.0.1:80/nginx_status')
|
||||
result = public.httpGet('http://127.0.0.1/nginx_status')
|
||||
tmp = result.split()
|
||||
data = {}
|
||||
data['active'] = tmp[2]
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
location ~ [^/]\.php(/|$)
|
||||
{
|
||||
try_files $uri =404;
|
||||
fastcgi_pass unix:/tmp/php-cgi-{$PHP_VERSION}.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
include pathinfo.conf;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
set $real_script_name $fastcgi_script_name;
|
||||
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
|
||||
set $real_script_name $1;
|
||||
set $path_info $2;
|
||||
}
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
|
||||
fastcgi_param SCRIPT_NAME $real_script_name;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
[global]
|
||||
request_terminate_timeout = 30
|
||||
include={$SERVER_PATH}/php/{$PHP_VERSION}/etc/php-fpm.d/*.conf
|
||||
;php_value[auto_prepend_file]={$SERVER_PATH}/md_start.php
|
||||
;php_value[auto_append_file]={$SERVER_PATH}/md_end.php
|
||||
@@ -1,7 +1,7 @@
|
||||
[www]
|
||||
user = www
|
||||
group = www
|
||||
listen = /tmp/php{$PHP_VERSION}.sock
|
||||
listen = /tmp/php-cgi-{$PHP_VERSION}.sock
|
||||
pm = dynamic
|
||||
pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
|
||||
+28
-5
@@ -5,6 +5,8 @@ import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import json
|
||||
import shutil
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
@@ -73,6 +75,27 @@ def contentReplace(content, version):
|
||||
return content
|
||||
|
||||
|
||||
def makeOpenrestyConf():
|
||||
if public.isInstalledWeb():
|
||||
s_pathinfo = getPluginDir() + '/conf/pathinfo.conf'
|
||||
d_pathinfo = public.getServerDir() + '/openresty/nginx/conf/pathinfo.conf'
|
||||
if not os.path.exists(d_pathinfo):
|
||||
shutil.copyfile(s_pathinfo, d_pathinfo)
|
||||
|
||||
info = getPluginDir() + '/info.json'
|
||||
content = public.readFile(info)
|
||||
content = json.loads(content)
|
||||
versions = content['versions']
|
||||
tpl = getPluginDir() + '/conf/enable-php.conf'
|
||||
tpl_content = public.readFile(tpl)
|
||||
for x in range(len(versions)):
|
||||
w_content = tpl_content.replace('{$PHP_VERSION}', versions[x])
|
||||
desc_file = public.getServerDir() + '/openresty/nginx/conf/enable-php-' + \
|
||||
versions[x] + '.conf'
|
||||
if not os.path.exists(desc_file):
|
||||
public.writeFile(desc_file, w_content)
|
||||
|
||||
|
||||
def phpFpmReplace(version):
|
||||
|
||||
tpl_php_fpm = getPluginDir() + '/conf/php-fpm.conf'
|
||||
@@ -98,9 +121,10 @@ def phpFpmWwwReplace(version):
|
||||
public.writeFile(service_php_fpmwww, content)
|
||||
|
||||
|
||||
def initDreplace(version):
|
||||
def initReplace(version):
|
||||
makeOpenrestyConf()
|
||||
|
||||
file_tpl = getConf(version)
|
||||
file_tpl = getPluginDir() + '/init.d/php.tpl'
|
||||
service_path = public.getServerDir()
|
||||
|
||||
initD_path = getServerDir() + '/init.d'
|
||||
@@ -121,12 +145,11 @@ def initDreplace(version):
|
||||
|
||||
|
||||
def phpOp(version, method):
|
||||
file = initDreplace(version)
|
||||
file = initReplace(version)
|
||||
data = public.execShell(file + ' ' + method)
|
||||
print data
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
return data[1]
|
||||
|
||||
|
||||
def start(version):
|
||||
|
||||
Reference in New Issue
Block a user