我在创建nginx反向代理时遇到问题,前面创建网站是成功的,到创建反向代理就遇到问题
- def createSiteAndProxy(self,domain,container_ipaddress):
- _proxy = 'http://' + container_ipaddress + ':8888'
- url = self.__BT_PANEL + '/site?action=AddSite'
-
- # webname=%7B%22domain%22%3A%22test-1.vbt.baseyun.cn%22%2C%22domainlist%22%3A%5B%5D%2C%22count%22%3A0%7D&type=PHP&port=80&ps=test-1.vbt.baseyun.cn&path=%2Fwww%2Fwwwroot%2Ftest-1.vbt.baseyun.cn&type_id=0&version=00&ftp=false&sql=false&codeing=utf8mb4
- p_data = self.__get_key_data()
- p_data['webname'] = '{"domain":"%s","domainlist":[],"count":0}' % domain
- p_data['type'] = 'php'
- p_data['port'] = '80'
- p_data['ps'] = domain
- p_data['path'] = '/www/wwwroot/' + domain
- p_data['type_id'] = '0'
- p_data['version'] = '00'
- p_data['ftp'] = 'false'
- p_data['sql'] = 'false'
- p_data['codeing'] = 'utf8mb4'
-
- result = self.__http_post_cookie(url,p_data)
- result = json.loads(result)
-
-
- if 'siteStatus' not in result or result['siteStatus'] != True:
- return False, result
-
- siteId = result['siteId']
- # 创建反向代理
- url = self.__BT_PANEL + 'site?action=CreateProxy'
- p_data = None
- p_data = self.__get_key_data()
- # type=1&proxyname=container-proxy&cachetime=1&proxydir=%2F&proxysite=http%3A%2F%2F172.17.0.2%3A8888&todomain=%24host&cache=0&advanced=0&sitename=test-1.vbt.baseyun.cn&subfilter=%5B%7B%22sub1%22%3A%22%22%2C%22sub2%22%3A%22%22%7D%2C%7B%22sub1%22%3A%22%22%2C%22sub2%22%3A%22%22%7D%2C%7B%22sub1%22%3A%22%22%2C%22sub2%22%3A%22%22%7D%5D
- p_data['type'] = '1'
- p_data['proxyname'] = 'container-proxy'
- p_data['cachetime'] = '1'
- p_data['proxydir'] = '/'
- p_data['proxysite'] = _proxy
- p_data['todomain'] = '$host'
- p_data['cache'] = '0'
- p_data['advanced'] = '0'
- p_data['sitename'] = domain
- p_data['subfilter'] = '[{"sub1":"","sub2":""},{"sub1":"","sub2":""},{"sub1":"","sub2":""}]'
- print(url)
- result = self.__http_post_cookie(url,p_data)
- print(result)
- result = json.loads(result)
- if 'status' not in result or result['status'] != True:
- return False, result['msg']
-
- return True, siteId
复制代码
到创建反向代理时候,api给我返回了,这里该怎么解决呢
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>安全入口校验失败</title>
- </head>
- <body>
- <h1>请使用正确的入口登录面板</h1>
- <p><b>错误原因:</b>当前新安装的已经开启了安全入口登录,新装机器都会随机一个8位字符的安全入口名称,亦可以在面板设置处
- 修改,如您没记录或不记得了,可以使用以下方式解决</p>
- <p><b>解决方法:</b>在SSH终端输入以下一种命令来解决</p>
- <p>1.查看面板入口:/etc/init.d/bt default</p>
- <p style="color:red;">注意:【关闭安全入口】将使您的面板登录地址被直接暴露在互联网上,非常危险,请谨慎操作</p>
- </body>
复制代码
|
|