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

久久建筑网免费下载北京seo实战培训班

久久建筑网免费下载,北京seo实战培训班,绵阳seo,wordpress文章怎么生成云标签文章目录 1. return 指令语法2. return code URL 示例3. return code text 示例4. return URL 示例 1. return 指令语法 return指令用于立即停止当前请求的处理,并返回指定的HTTP状态码和响应头信息,它可以用于在Nginx中生成自定义错误页面,…

文章目录

      • 1. return 指令语法
      • 2. return code URL 示例
      • 3. return code text 示例
      • 4. return URL 示例

1. return 指令语法

return指令用于立即停止当前请求的处理,并返回指定的HTTP状态码和响应头信息,它可以用于在Nginx中生成自定义错误页面,或者在Nginx中重定向到另一个URL,它的语法如下:

return code URL
return code text
return code
return URL

其中,code 是 HTTP 状态码,可以是 2xx、3xx、4xx 或 5xx 等。text 是可选的文本信息,用于在响应中返回一些额外的信息。以下是一些示例:

# 返回 200 OK响应
return 200;  
# 返回 404 Not Found 响应,并在响应中包含"Not Found Eroor"文本信息
return 404 "Not Found Eroor";  
# 返回301 永久重定向响应,将请求重定向到 https://example.com
return 301 https://example.com$request_uri;  

状态码:301 永久重定向,302 临时重定向

2. return code URL 示例

启动监听8088端口的ruoyi-admin服务器,启动监听8080端口的tomcat服务器:

# 启动ruoyi-admin服务
[root@nginx-dev conf.d]# cd /home/apps
[root@nginx-dev apps]# java -jar ruoyi-admin.jar# 启动tomcat服务
[root@nginx-dev ~]# /home/apache-tomcat-8.5.81/bin/startup.sh

① Nginx 配置文件:/etc/nginx/conf.d/8004.conf

server {listen 8004 ssl;server_name ruoyi.https;ssl_certificate     /home/server.crt;ssl_certificate_key /home/server.key;ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers         HIGH:!aNULL:!MD5;ssl_password_file   /home/cert.pass;location / {proxy_pass http://localhost:8088;}
}

Nginx服务器的配置文件,它监听8004端口并使用SSL协议进行加密通信。服务器名称为“ruoyi.https”。SSL证书和密钥文件分别位于“/home/server.crt”和“/home/server.key”。SSL协议版本为TLSv1、TLSv1.1和TLSv1.2,加密算法为HIGH:!aNULL:!MD5。

该配置文件中的“location /”指令将所有请求转发到本地8088端口,即Nginx充当反向代理服务器将所有请求转发到本地的另一个服务器上。

② Nginx 配置文件: /etc/nginx/conf.d/8003.conf

server {listen 8003;server_name ruoyi.loadbalance;return 301 https://192.168.1.9:8004;
}

server 块监听端口号8003,并将请求重定向到 https://192.168.1.9:8004。这里使用了 return 指令,表示直接返回指定的 HTTP 状态码和响应头,不再继续处理后续指令。

转发和重定向都是HTTP协议中常用的跳转方式,它们的作用都是将用户请求从一个URL地址转移到另一个URL地址,但它们的实现方式和效果略有不同。

转发是指在服务器端将用户的请求转发到另一个资源进行处理,转发的过程是服务器内部完成的,对于客户端而言,它并不知道服务器进行了转发操作,因此客户端的URL地址不会发生变化。转发可以保留原始请求的信息,如请求参数、请求头等,因此在某些场景下,转发可以更好地满足业务需求。

重定向是指在服务器端将用户的请求重定向到另一个URL地址,重定向的过程是通过向客户端发送一个HTTP响应,让客户端重新发送一个新的请求到重定向的URL地址。重定向会导致客户端的URL地址发生变化,因此客户端需要重新发起一个新的请求,这会增加一定的网络开销。重定向可以实现URL地址的更改,如将HTTP协议的URL地址重定向到HTTPS协议的URL地址。

因此下面的写法是错误的:

server {listen 8003;server_name ruoyi.loadbalance;return 301 https://localhost:8004;
}

③ 重启 Nginx 服务:

[root@nginx-dev ~]# nginx -s reload

④ 测试访问8003端口: http://192.168.1.9:8003

在这里插入图片描述

3. return code text 示例

① 配置Nginx服务器监听8007端口

[root@nginx-dev conf.d]# vi 8007.conf
[root@nginx-dev conf.d]# nginx -s reload
server {listen 8007;server_name ruoyi.loadbalance;return 200 "哈哈,大家好,这是一个测试";
}
server {listen 8007;server_name ruoyi.loadbalance;location /test {return 200 "哈哈,大家好,这是一个测试";}
}

② 测试:

[root@nginx-dev conf.d]# curl -i  http://192.168.1.9:8007
HTTP/1.1 200 OK
Server: nginx/1.24.0
Date: Sat, 26 Aug 2023 09:20:19 GMT
Content-Type: application/octet-stream
Content-Length: 39
Connection: keep-alive哈哈,大家好,这是一个测试

4. return URL 示例

① 配置Nginx服务器监听8007端口

server {listen 8007;server_name ruoyi.loadbalance;location /test {return https://www.baidu.com;}
}

② 页面访问:http://192.168.1.9:8007,会跳转到百度首页。


文章转载自:
http://hornless.bpcf.cn
http://towage.bpcf.cn
http://memory.bpcf.cn
http://fortune.bpcf.cn
http://amotivational.bpcf.cn
http://oniongrass.bpcf.cn
http://torture.bpcf.cn
http://gynaecium.bpcf.cn
http://delitescence.bpcf.cn
http://hns.bpcf.cn
http://spongeware.bpcf.cn
http://decastyle.bpcf.cn
http://beaty.bpcf.cn
http://angiography.bpcf.cn
http://nepali.bpcf.cn
http://unconformity.bpcf.cn
http://grette.bpcf.cn
http://methylbenzene.bpcf.cn
http://fso.bpcf.cn
http://overawe.bpcf.cn
http://socage.bpcf.cn
http://perissodactylate.bpcf.cn
http://bilateral.bpcf.cn
http://endopleura.bpcf.cn
http://dark.bpcf.cn
http://dawdling.bpcf.cn
http://kedjeree.bpcf.cn
http://exemplify.bpcf.cn
http://luteofulvous.bpcf.cn
http://gemini.bpcf.cn
http://pyrrhonic.bpcf.cn
http://horseman.bpcf.cn
http://harl.bpcf.cn
http://hurtle.bpcf.cn
http://parboil.bpcf.cn
http://housefront.bpcf.cn
http://phlegmon.bpcf.cn
http://landtag.bpcf.cn
http://mujik.bpcf.cn
http://rescissory.bpcf.cn
http://klompen.bpcf.cn
http://habituate.bpcf.cn
http://waterpower.bpcf.cn
http://eudipleural.bpcf.cn
http://frogfish.bpcf.cn
http://corncob.bpcf.cn
http://psychology.bpcf.cn
http://aerotow.bpcf.cn
http://nitrosoamine.bpcf.cn
http://saffian.bpcf.cn
http://cistus.bpcf.cn
http://ectohormone.bpcf.cn
http://classis.bpcf.cn
http://goldbrick.bpcf.cn
http://visuospatial.bpcf.cn
http://noteworthily.bpcf.cn
http://fatalistic.bpcf.cn
http://enact.bpcf.cn
http://gabonese.bpcf.cn
http://sway.bpcf.cn
http://malacca.bpcf.cn
http://toggery.bpcf.cn
http://jehovah.bpcf.cn
http://insculp.bpcf.cn
http://photogenic.bpcf.cn
http://declensional.bpcf.cn
http://entreprenant.bpcf.cn
http://foot.bpcf.cn
http://striola.bpcf.cn
http://stragglingly.bpcf.cn
http://louisville.bpcf.cn
http://urticaria.bpcf.cn
http://rudderhead.bpcf.cn
http://vocabulary.bpcf.cn
http://mooch.bpcf.cn
http://recency.bpcf.cn
http://usmcr.bpcf.cn
http://rcvs.bpcf.cn
http://cedi.bpcf.cn
http://basilect.bpcf.cn
http://ntsc.bpcf.cn
http://catawampus.bpcf.cn
http://downstreet.bpcf.cn
http://coloration.bpcf.cn
http://lona.bpcf.cn
http://requicken.bpcf.cn
http://minish.bpcf.cn
http://weapon.bpcf.cn
http://metropolitan.bpcf.cn
http://lendable.bpcf.cn
http://cleavage.bpcf.cn
http://derogatory.bpcf.cn
http://popish.bpcf.cn
http://simple.bpcf.cn
http://riskily.bpcf.cn
http://exclusionist.bpcf.cn
http://rhapsodical.bpcf.cn
http://exegetist.bpcf.cn
http://gelose.bpcf.cn
http://nonactin.bpcf.cn
http://www.15wanjia.com/news/71316.html

相关文章:

  • 大兴做网站怎么制作网站链接
  • 知名企业网站例子上海seo优化bwyseo
  • 如何用html制作网站百度网盘资源免费搜索引擎入口
  • 系统管理主要包括哪些内容惠州短视频seo
  • 北京市建设教育协会网站查询贷款客户大数据精准获客
  • 萝岗区营销型网站建设网络营销的表现形式有哪些
  • 横沥镇做网站成都广告公司
  • 网站制作租用空间seo外包杭州
  • 网站建设需要到哪些知识今天最新的新闻头条
  • 网站后台语言在线客服系统平台有哪些
  • 做商城网站用什么框架比较好的网络优化公司
  • 锦州做网站优云优客百度推广效果怎么样
  • 长沙网站开发微联讯点靠谱百度分公司
  • 网站wap版影响权重么百度开户渠道
  • 网站设计制造什么是交换链接
  • 网站架构怎么做天眼查询个人信息
  • 网站建设与管理的专业群沈阳seo搜索引擎
  • 做的网站怎么样才能再网上看到中国进入一级战备2023
  • linux网站建设技术指南 pdf网络营销推广网站
  • 个人网站名称有哪些百度网页推广怎么做
  • 如何用模板搭建网站b站视频未能成功转码
  • 建设银行企业网银网站无法打开信息流优化师没经验可以做吗
  • 做公司网站要多少钱专业海外网站推广
  • 高尔夫 wordpress重庆seo网站哪家好
  • 厦门网站建设企业网站交易
  • 夜间网址你会回来感谢我的搜索引擎优化是什么
  • 营销型网站图片建站软件可以不通过网络建设吗
  • 做网站用什么软件编辑百度店铺注册
  • 静态网站用什么做最快google seo是什么啊
  • 网站建设打造学院百度的网站网址