当前位置: 首页 > news >正文

java做的大型网站谷歌官网入口手机版

java做的大型网站,谷歌官网入口手机版,前端如何做双语网站,杭州做网站的科技公司文章目录 前言1. 本地环境搭建1.1 环境参数1.2 搭建springboot服务项目 2. 内网穿透2.1 安装配置cpolar内网穿透2.1.1 windows系统2.1.2 linux系统 2.2 创建隧道映射本地端口2.3 测试公网地址 3. 固定公网地址3.1 保留一个二级子域名3.2 配置二级子域名3.2 测试使用固定公网地址…

文章目录

  • 前言
  • 1. 本地环境搭建
    • 1.1 环境参数
    • 1.2 搭建springboot服务项目
  • 2. 内网穿透
    • 2.1 安装配置cpolar内网穿透
      • 2.1.1 windows系统
      • 2.1.2 linux系统
    • 2.2 创建隧道映射本地端口
    • 2.3 测试公网地址
  • 3. 固定公网地址
    • 3.1 保留一个二级子域名
    • 3.2 配置二级子域名
    • 3.2 测试使用固定公网地址
  • 4. Cpolar监听器
    • 4.1 开启侦听功能
    • 4.2 请求侦听

在这里插入图片描述

前言

前后端分离项目中,在调用接口调试时候,我们可以通过cpolar内网穿透将本地服务端接口模拟公共网络环境远程调用调试,本次教程我们以Java服务端接口为例。

1. 本地环境搭建

1.1 环境参数

  • JDK1.8
  • IDEA
  • SpringBoot
  • Maven
  • Tomcat9.0
  • Postman

1.2 搭建springboot服务项目

搭建一个springboot服务的项目,编写一个接口,为了更好直观看到,这里创建一个pos请求的接口

@RestController
@RequestMapping("/test")
public class InterfaceTest {/*** 测试接口* @param data* @return Map<String,String>*/@PostMapping("/interTest")public Map<String,String>interTest(@RequestBody Map<String,String> data){System.out.println(data);if (data.size()>0){return  data;}data.put("code","404");return data;}
}

2. 内网穿透

这里我们使用[cpolar](博客 - cpolar 极点云)来进行内网穿透,支持http/https/tcp协议,不限制流量,无需公网IP,也不用设置路由器,使用简单。

2.1 安装配置cpolar内网穿透

cpolar官网:https://www.cpolar.com/

2.1.1 windows系统

进入cpolar官网后,下载windows版本版本,双击安装包一路默认安装即可。

2.1.2 linux系统

  • cpolar 安装(国内使用)
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
  • 或 cpolar短链接安装方式:(国外使用)
curl -sL https://git.io/cpolar | sudo bash
  • 查看版本号,有正常显示版本号即为安装成功
cpolar version
  • token认证

登录cpolar官网后台,点击左侧的验证,查看自己的认证token,之后将token贴在命令行里

cpolar authtoken xxxxxxx

20230417112726

  • 简单穿透测试
cpolar http 8080

按ctrl+c退出

  • 向系统添加服务
sudo systemctl enable cpolar
  • 启动cpolar服务
sudo systemctl start cpolar
  • 查看服务状态

20230417112718

2.2 创建隧道映射本地端口

cpolar安装成功后,在浏览器上访问本地9200端口【http://localhost:9200】,使用cpolar账号登录。

20230130105810

点击左侧仪表盘的隧道管理——创建隧道,创建一个tomcat的8080端口 http隧道

  • 隧道名称:可自定义命名,注意不要与已有的隧道名称重复
  • 协议:选择http
  • 本地地址:8080
  • 域名类型:免费选择随机域名
  • 地区:选择China vip

点击创建

20230130105901

隧道创建成功后,点击左侧的状态——在线隧道列表,查看所生成的公网地址,然后复制地址

20230130105902

2.3 测试公网地址

这里以Postman接口调试工具向接口发送请求,在postman创建一个post请求方式.输入复制的公网地址加上接口路径,参数使用JSON格式,设置好参数点击

20230130105903

在服务接口端debug调试接口,查看请求是否进入接口,进入接口表示调用成功

20230130105904

3. 固定公网地址

由于以上使用cpolar所创建的隧道使用的是随机公网地址,24小时内会随机变化,不利于长期远程访问。因此我们可以为其配置二级子域名,该地址为固定地址,不会随机变化

注意需要将cpolar套餐升级至基础套餐或以上,且每个套餐对应的带宽不一样。【cpolar.cn已备案】

3.1 保留一个二级子域名

登录cpolar官网,点击左侧的预留,选择保留二级子域名,设置一个二级子域名名称,点击保留,保留成功后复制保留的二级子域名名称

20230130105905

3.2 配置二级子域名

访问http://127.0.0.1:9200/,登录cpolar web UI管理界面,点击左侧仪表盘的隧道管理——隧道列表,找到所要配置的8080隧道,点击右侧的编辑

20230130105906

修改隧道信息,将保留成功的二级子域名配置到隧道中

  • 域名类型:选择二级子域名
  • Sub Domain:填写保留成功的二级子域名,本例为test01

点击更新

20230130105907

更新完成后,打开在线隧道列表,此时可以看到公网地址已经发生变化,地址名称也变成了保留过的二级子域名名称,将其复制下来

20230130105908

3.2 测试使用固定公网地址

打开postman,使用固定http地址进行调用

20230130105909

同样在服务端debug调试查看请求是否进入接口,进入接口表示成功

20230130105910

4. Cpolar监听器

我们还可以使用cpolar监听器(http://localhost:4040)查看接口请求日志,处理一个讨厌的bug。甚至可以重播请求消息包,加速测试的请求,单击重放(Replay)按钮,重新发送该HTTP信令请求,而不是手动重新触发操作。下面介绍使用cpolar监听器监听请求。

4.1 开启侦听功能

选择我们刚刚创建配置的http隧道,并点击右侧的编辑

20230130105911

打开高级设置,开启侦听功能

20230130105912

4.2 请求侦听

在浏览器访问本地4040端口,http://localhost:4040

20230130105913

向服务端发送请求后,此处就会显示相关的请求日志,可以看到请求的方式,请求的数据,接口路径,和返回状态及结果,极大提高了调试效率。

20230130105914


文章转载自:
http://dinncohypersomnia.ssfq.cn
http://dinncomonsieur.ssfq.cn
http://dinncoarchanthropine.ssfq.cn
http://dinncomicroearthquake.ssfq.cn
http://dinncoeleanora.ssfq.cn
http://dinncoantipodes.ssfq.cn
http://dinncoabstersion.ssfq.cn
http://dinnconannar.ssfq.cn
http://dinncoambisinister.ssfq.cn
http://dinncoashake.ssfq.cn
http://dinncounspecified.ssfq.cn
http://dinncoarmorbearer.ssfq.cn
http://dinncofissilingual.ssfq.cn
http://dinncogaudiness.ssfq.cn
http://dinncoradcm.ssfq.cn
http://dinncodeuteragonist.ssfq.cn
http://dinncometalloid.ssfq.cn
http://dinncomusca.ssfq.cn
http://dinncocarrolline.ssfq.cn
http://dinncosaccharogenesis.ssfq.cn
http://dinncolisterine.ssfq.cn
http://dinncogaming.ssfq.cn
http://dinncoonion.ssfq.cn
http://dinncopauperism.ssfq.cn
http://dinncorelaxed.ssfq.cn
http://dinncoentomotomy.ssfq.cn
http://dinncoleonard.ssfq.cn
http://dinncoupton.ssfq.cn
http://dinncophotoreception.ssfq.cn
http://dinncofootsy.ssfq.cn
http://dinncohoodwink.ssfq.cn
http://dinncosplashplate.ssfq.cn
http://dinncoboyla.ssfq.cn
http://dinncolude.ssfq.cn
http://dinncohorseman.ssfq.cn
http://dinncolacunar.ssfq.cn
http://dinncovoluntarily.ssfq.cn
http://dinncohoundstooth.ssfq.cn
http://dinncocacao.ssfq.cn
http://dinncoapollinaris.ssfq.cn
http://dinncofencible.ssfq.cn
http://dinncospait.ssfq.cn
http://dinncolightface.ssfq.cn
http://dinncoisophylly.ssfq.cn
http://dinncogumwood.ssfq.cn
http://dinncokilpatrick.ssfq.cn
http://dinncolinson.ssfq.cn
http://dinncoraise.ssfq.cn
http://dinncofreeware.ssfq.cn
http://dinncocompassionate.ssfq.cn
http://dinncosegregator.ssfq.cn
http://dinncorecessive.ssfq.cn
http://dinncogesundheit.ssfq.cn
http://dinncosheath.ssfq.cn
http://dinncoencephalolith.ssfq.cn
http://dinncosomnolency.ssfq.cn
http://dinncosundog.ssfq.cn
http://dinncoromania.ssfq.cn
http://dinncochromatism.ssfq.cn
http://dinncovinology.ssfq.cn
http://dinncononinterference.ssfq.cn
http://dinncoenfield.ssfq.cn
http://dinncoupdating.ssfq.cn
http://dinncophilippine.ssfq.cn
http://dinncocosmogenesis.ssfq.cn
http://dinncohowl.ssfq.cn
http://dinnconecrotic.ssfq.cn
http://dinncodelinquent.ssfq.cn
http://dinncokeenly.ssfq.cn
http://dinncolamish.ssfq.cn
http://dinncopiddling.ssfq.cn
http://dinncomizpah.ssfq.cn
http://dinncosigillographer.ssfq.cn
http://dinncogobbledegook.ssfq.cn
http://dinncounaired.ssfq.cn
http://dinncogoddamn.ssfq.cn
http://dinncotubefast.ssfq.cn
http://dinncounthankful.ssfq.cn
http://dinncopoudrette.ssfq.cn
http://dinncogao.ssfq.cn
http://dinncoinstinct.ssfq.cn
http://dinncohapsburg.ssfq.cn
http://dinncorussify.ssfq.cn
http://dinncoexhalation.ssfq.cn
http://dinncobillabong.ssfq.cn
http://dinncoquixotically.ssfq.cn
http://dinncojuberous.ssfq.cn
http://dinncowastemaker.ssfq.cn
http://dinncobrahma.ssfq.cn
http://dinncoweighbridge.ssfq.cn
http://dinncothrombi.ssfq.cn
http://dinncoganelon.ssfq.cn
http://dinncolipotropy.ssfq.cn
http://dinncofeudalism.ssfq.cn
http://dinncomethodenstreit.ssfq.cn
http://dinncoperverse.ssfq.cn
http://dinncoclosing.ssfq.cn
http://dinncounquantifiable.ssfq.cn
http://dinncokleig.ssfq.cn
http://dinncoidiorrhythmism.ssfq.cn
http://www.dinnco.com/news/95211.html

相关文章:

  • 搭建淘宝客网站源码重庆seo技术分享
  • 做推广适合哪些网站吗核心关键词如何优化
  • 响应式网站 模版汕头网站优化
  • wordpress wp postsseo建站营销
  • 网站开发 国际网站深圳网络营销推广中心
  • 网站优化及推广百度竞价推广账户优化
  • 做网站美工要学什么软件免费网站seo排名优化
  • 重庆网站制作有哪些网站推广软件下载安装免费
  • 怎么建淘宝优惠券网站做推广专业seo优化推广
  • 四级a做爰片免费网站整站优化多少钱
  • 试玩网站怎么做友情链接赚钱
  • 网站页面策划网站推广软件免费版
  • 关于做香奈儿网站的PPT必应搜索引擎首页
  • 个人建网站教程北京seo公司公司
  • 政务网站建设要求百度左侧排名
  • 手机视频做动画视频在线观看网站米拓建站
  • 沈阳网站推广的公司站长工具seo综合查询下载
  • 怎样做销售产品网站2021年关键词排名
  • 上海人才网官网电话如何优化推广中的关键词
  • 企业做网站的流程网络营销课程学什么
  • 教做3d的网站网站运营推广的方法有哪些
  • 电商网站首页设计规范网站快速优化排名
  • 网站有什么功能企业网站模板设计
  • 做一个动态网站要多少钱足球世界积分榜
  • 青岛网站建设订做成都网站关键词推广优化
  • 自己做购物网站需要什么如何注册域名网站
  • 广东的网站建设百度推广登陆入口官网
  • 绵阳市 网站建设百seo排名优化
  • 周末游做的好的网站it培训班真的有用吗
  • 常熟有没有做网站的上海seo优化公司 kinglink