开启一个 https 服务器(一行 json 搞定,所有配置都 ajax post), OPener_Server 第 6 弹

2016-11-25 23:52:30 +08:00
 openercn

OPener_Server 所有的配置及后续运行全部依托 ajax post json 数据。

不像 nginx 、 apache , OPener_server 没有复杂的配置文件,也没有找不到配置目录的困难。

所有的一切全部一行 json ,然后 ajax post 到 OPener_Server 就可以了。

启动一个 http 服务器,并设定一个根目录

继续 jquery :


var start_http_server3={'action':'new_http_server','ip':'','port':'1010'}; // 开启一个新的 http 服务器,监听在端口 1010 上
var reg_url={'action':'reg_url','type':'file_root','url':'/*','host':'*:1010','go':'/root'}; 

url_post_data(url,JSON.stringify(start_http_server3)); 
url_post_data(url,JSON.stringify(reg_url));

启动一个 https 服务器,并设定一个可浏览目录

继续 jquery :


var start_http_server4={'action':'new_https_server','ip':'','port':'1011','cert_file':'opener.pem'}; // 开启一个新的 https 服务器,监听在端口 1011 上,指定证书文件是 opener.pem
var reg_url={'action':'reg_url','type':'file_index','url':'/index','host':'*:1011','go':'/root'}; 

url_post_data(url,JSON.stringify(start_http_server4)); 
url_post_data(url,JSON.stringify(reg_url));

OPener_Server 教程:

第 1 弹: https://www.v2ex.com/t/320838
第 2 弹: https://www.v2ex.com/t/321686
第 3 弹: https://www.v2ex.com/t/322192
第 4 弹: https://www.v2ex.com/t/322488
第 5 弹: https://www.v2ex.com/t/322698

项目地址: https://github.com/openerserver/openerserver_perl

微博: http://weibo.com/openerserver

微信公众号:

1991 次点击
所在节点    程序员
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/323380

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX