一、本地环境,不包括域名的方法:

https://www.npmjs.com/package/http-server(参考手册)

正确使用方法:aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAogAAADXCAIAAAAWbDfmAAAgAElEQVR4nO2dWbIkx3FFc51agBagFdQuuAQRIzFw+C0jMQ8EyC8RxDw1BprEUdamL300WZ0V7n7jukfky6z37rFnsKxIj+tDRIa/qu5qLP/9t//Tj370ox/96Ec/B/lZdo9AP/rRj370ox/9XH7+2Zh/9fs//er3f/rsx//9t3//j0UIIYQQd87jx4+/+uorNWYhhBDiEKgxCyGEEAdCjVkIIYQ4EGrMQgghxIFQYxZCCCEOhBqzEEIIcSDUmIUQQogDocYshBBCHAg1ZiGEEOJAqDELIYQQB0KNWQghhDgQasxCCCHEgVBjFkIIIQ6EGrMQQghxINSYhRBCiAOhxiyEEEIciLAxnz0KDpqJvE7BKWnvmo3k6OpMUSv4xSFFdzeOLkETDNiE2XEhhLgJ0Dtme95hLebcT52VGzXmyHLWOX7RqQmWY8DubqIx22DIsKOaHyo7IYRgSDTmNe7bEdDtLuObNuYUfA8YUXb7RKF9Zv3OVb4DzivseGTfzAXjQghxK7CN2T0uozbsWoJzE0xxu1rkl7d3o3WDZHSAbCTFT2ymMOKgRHaEH08RxU/OAiOR/vl67cazmFIHIYTI0m/M2bMJdwt7gA5eR64Ze9fMPd+7OkwY/CygA8SxX6ZoheDPHjUpEHajvFwXZPHqY8uVir8QvBBCTKH4jhnjHmrkwYev3TPa9WtfpuxHzuXCXNcMlDEVP44kWzSeWXUAgrYs0fgdBC+EEFOY+WfM1mAJDlN3nL/uOu0OuuPYHX86Ax23bkyE3bqV4wcig2SXr2tmBaP6ZP1OCV4IIaZQ/FvZboNpOK9oBpf44MteW4+MvasADnrsN9KJ/LoFIdMB8RRSzoqkGCldVyQKmy/v9OCFEGIK236P2U605110Fttz1rXvHtb4rI9CZeLEKfP2WSm3Ps1FVIcor3K+ODVeKgoGxMPYj6Qwqw5CCJHi5v/lL9tR9oxmKreezq3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o4/NE5712H3AIQQQpShGvNpddCfzA8zvphxgBUB4ycYp73O6mTjPJkfxn4xt6LxSMe6FkIIcYv0G/NpWZagZzQw4yfTb06cIxCA1ZyoE8HoFOy71yljIYQQNwf7UXZ0vYYZj2y6OifinejiXbjXvE42zmg8iqcbanN9CuIH+kIIIW6IIzZm1xJMdG9FTrM6XeysVDzglnvtimN9IYQQN8RQYz4FDSYat7csXadY30rxwXRjY+JcgjqQfrvXKePGRTMohBDigLDfYz55vWQ9AsZP1z9dImN3HCvjIHmdVJxLJv5mPAqJCXU9GE0RQghxcO7iX/46qSVATpnfKoQQQtxvNm/MJ71dg5ySb6+FEELcb/RvZQshhBAH4vHjx++++64asxBCCHEIHj9+/Pzzz6sxCyGEEIfg8ePHP/nJT9SYhRBCiEOgxiyEEEIciOvG/MGPr36gxiyEEELshhqzEEIIcSDUmIUQQogD4TXm79WYhRBCiH140pj/H+7yiOBM2RHFAAAAAElFTkSuQmCC" alt="" />

二、带域名的配置方法:

https://cnodejs.org/topic/50d41da5637ffa4155f63179和http://blog.csdn.net/yuan882696yan/article/details/25052469(参考方法)

nodejs通过代理(proxy)发送http请求(request):

方法一:

request.post({url:url,proxy:'http://username:password@kws.proxy.nic.fujitsu.com:8080',oauth:oauth}

var options = {
        host: "kws.proxy.nic.fujitsu.com",
        port: 8080,
        path: requestPath,
headers: {
   'Proxy-Authentication': 'Base ' + new Buffer('username:password').toString('base64')
   }
 };

var reqUrl = request(url,{'proxy':'http://username:password@kws.proxy.nic.fujitsu.com:8080'});

注意:用户名,密码在url中的写法

方法二:

有可能有这样的需求,需要node作为web服务器通过另外一台http/https代理服务器发http或者https请求,废话不多说直接上代码大家都懂的:

var http = require('http')
var opt = {
host:'这里放代理服务器的ip或者域名',
port:'这里放代理服务器的端口号',
method:'POST',//这里是发送的方法
path:' https://www.google.com', //这里是访问的路径
headers:{
//这里放期望发送出去的请求头
}
}
//以下是接受数据的代码
var body = '';
var req = http.request(opt, function(res) {
console.log("Got response: " + res.statusCode);
res.on('data',function(d){
body += d;
}).on('end', function(){
console.log(res.headers)
console.log(body)
}); }).on('error', function(e) {
console.log("Got error: " + e.message);
})
req.end();

这样我们就通过了指定代理服务器发出了https的请求,注意这里我们同代理服务器是http协议的,不是https,返回的结果当然肯定会根据你的代理服务器不同有所不同。

用nodejs http-server搭建本地服务环境的更多相关文章

  1. 用node搭建本地服务环境

    const express = require('express'); const path = require('path'); const request = require('request') ...

  2. 图文详解linux如何搭建lamp服务环境

    企业网站建设必然离不开服务器运维,一个稳定高效的服务器环境是保证网站正常运行的重要前提.本文小编将会详细讲解Linux系统上如何搭建配置高效的lamp服务环境,并在lamp环境中搭建起企业自己的网站. ...

  3. webpack-dev-server 搭建本地服务以及浏览器实时刷新

    一.概述开发项目中为了保证上线,开发项目是都需要使用localhost进行开发,以前的做法就是本地搭建Apache或者Tomcat服务器.有的前端开发人员 对服务器的搭建和配置并不熟悉,这个时候需要后 ...

  4. docker 搭建 web 服务环境

    docker容器虽然早就听说过,但是本人还真的没去用过,刚好看到相关的文章,就分享了下,有机会可以实践下...... 做过开发的人对开发环境的安装.配置应该都不会太陌生,不管你做什么开发,对开发环境都 ...

  5. JBOSS安装与配置搭建本地项目环境(方便前端开发调式)

    JBOSS安装与配置搭建本地项目环境  什么是JBOSS? JBOSS是EJB的服务器,就像Tomcat是JSP服务器一样,就是服务器的一种. 环境搭建如下: 一:首先安装JDK,配置环境变量(PAT ...

  6. 使用WampServer搭建本地PHP环境,绑定域名,配置伪静态

    倡萌之前介绍过 USBWebserver 快速搭建本地PHP环境 ,推荐USBWebserver的原因在于它是绿色的,不需要安装,想使用就手动运行下即可.但是 USBWebserver 也有自身的弱点 ...

  7. 利用Docker搭建本地https环境的完整步骤

    利用Docker搭建本地https环境的完整步骤 这篇文章主要给大家介绍了关于如何利用Docker搭建本地https环境的完整步骤,文中通过示例代码将实现的步骤介绍的非常详细,对大家的学习或者工作具有 ...

  8. 利用Docker Compose快速搭建本地测试环境

    前言 Compose是一个定义和运行多个Docker应用的工具,用一个YAML(dockder-compose.yml)文件就能配置我们的应用.然后用一个简单命令就能启动所有的服务.Compose编排 ...

  9. Ubuntu Server搭建svn服务以及迁移方法【转】

    转自:http://www.linuxidc.com/Linux/2013-05/84693.htm Ubuntu Server搭建svn服务以及迁移方法 采用apache+svn,http访问方式. ...

随机推荐

  1. numpy二分查找

    a = np.array([1, 2, 2, 3]) print(np.searchsorted(a, 0)) # 0 print(np.searchsorted(a, 1)) # 0 print(n ...

  2. hihocoder第196周

    此题解法:动态规划,倒骑毛驴. 在使用动态规划的时候,如果正着求难求,可以考虑倒着来. 这道题坑不少,自己代码能力太弱了,写代码的过程中总是容易犯细节错误.虽然大的方向是对的,但是小坑非常致命! 比如 ...

  3. nodejs中的exports和module.exports

    module是随文件而生的全局变量,它有exports属性,这个属性默认是一个空的字典. node的设计者画蛇添足有定义了一个exports全局变量,export指向module.exports所指向 ...

  4. Java用JSONObject-lib来解析json串

    直接贴代码:(所需jar包:json-lib.jar,可能会关联一些其它的jar包,请自行搜索.) import java.util.ArrayList; import java.util.HashM ...

  5. 给定数组a[1,2,3],用a里面的元素来生成一个长度为5的数组,打印出其排列组合

    给定数组a[1,2,3],用a里面的元素来生成一个长度为5的数组,打印出其排列组合 ruby代码: def all_possible_arr arr, length = 5 ret = [] leng ...

  6. 树莓派进阶之路 (032) -字符问题(2) - 用c语言怎样得到一个汉字的GB2312编码(转)

    C/C++支持的是ASCII,不过汉字编码中,GB2312与ASCII是兼容的,所以可以在C中获得汉字的GB2312编码 GB2312是两个字节的,第一字节是高八位,第二字节是低八位,比如下面的程序: ...

  7. php sockent通信

    1.php服务端:server.php <?php //确保在连接客户端时不会超时 set_time_limit(0); $ip = '127.0.0.1'; $port = 1935; /* ...

  8. 如何禁用Visual Studio 2013的浏览器链接功能

    VS2013新增的Browser Link功能虽然“强大”,但我并不需要. 但默认是开启的,会在页面中自动添加如下的代码,真是烦人! <!-- Visual Studio Browser Lin ...

  9. 【C语言】练习1-21

    题目来源:<The C programming language>中的习题 练习1-21:编写程序entab,将空格串替换为最好数量的制表符和空格,但要保持单词之间的间隔不变. 思路: 对 ...

  10. php截取字符去掉最后一个字符

    $str="中国.美国.俄罗斯.德国."$str=substr($str,0,-1); 输出结果为:中国.美国.俄罗斯.德国