• 请不要在回答技术问题时复制粘贴 AI 生成的内容
openercn
V2EX  ›  程序员

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

  •  
  •   openercn · Nov 25, 2016 · 2738 views
    This topic created in 3463 days ago, the information mentioned may be changed or developed.

    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

    微信公众号:

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5159 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 51ms · UTC 08:33 · PVG 16:33 · LAX 01:33 · JFK 04:33
    ♥ Do have faith in what you're doing.