V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
openercn
V2EX  ›  程序员

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

  •  
  •   openercn · 2016-11-25 23:52:30 +08:00 · 1981 次点击
    这是一个创建于 2713 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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

    微信公众号:

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1644 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 16:30 · PVG 00:30 · LAX 09:30 · JFK 12:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.