当前位置:网站首页>使用rewrite规则实现将所有到a域名的访问rewrite到b域名
使用rewrite规则实现将所有到a域名的访问rewrite到b域名
2022-07-05 22:44:00 【wwzroom】
使用rewrite规则实现将所有到a域名的访问rewrite到b域名
[[email protected] ~]#vim /apps/nginx/conf.d/pc.conf
server {
listen 80;
server_name www.aaa.com;
location / {
root /data/nginx/html/pc;
index index.html;
rewrite / http://www.bbb.com redirect;
}
}
server {
listen 80;
server_name www.bbb.com;
location / {
root /dara/nginx/html/mobile;
index index.html;
}
}
[[email protected] ~]#echo aaa > /data/nginx/html/pc/index.html
[[email protected] ~]#echo bbb > /data/nginx/html/mobile/index.html
[[email protected] ~]#vim /etc/hosts
10.0.0.58 www.aaa.com www.bbb.com
[[email protected] ~]#curl www.aaa.com
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center>nginx/1.18.0</center>
</body>
</html>
[[email protected] ~]#curl -L www.aaa.com
bbb
[[email protected] ~]#curl www.aaa.com -Lv (-L跟随跳转-v显示细节)
* Rebuilt URL to: www.aaa.com/
* Trying 10.0.0.58...
* TCP_NODELAY set
* Connected to www.aaa.com (10.0.0.58) port 80 (#0)
> GET / HTTP/1.1
> Host: www.aaa.com
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx
< Date: Fri, 01 Jul 2022 07:22:29 GMT
< Content-Type: text/html
< Content-Length: 162
< Connection: keep-alive
< Location: http://www.bbb.com
<
* Ignoring the response-body
* Connection #0 to host www.aaa.com left intact
* Issue another request to this URL: 'http://www.bbb.com'
* Rebuilt URL to: http://www.bbb.com/
* Trying 209.17.116.160...
* TCP_NODELAY set
* Connected to www.bbb.com (209.17.116.160) port 80 (#1)
> GET / HTTP/1.1
> Host: www.bbb.com
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Server: openresty/1.19.9.1
< Date: Fri, 01 Jul 2022 07:22:32 GMT
< Content-Type: text/html
< Content-Length: 175
< Connection: keep-alive
< Location: https://www.bbb.com/
边栏推荐
- Common model making instructions
- 700. Search in a Binary Search Tree. Sol
- audiopolicy
- The countdown to the launch of metaverse ape is hot
- 513. Find the value in the lower left corner of the tree
- 解决thinkphp启动时“No input file specified”的问题
- Distance from point to line intersection and included angle of line
- Platformio create libopencm3 + FreeRTOS project
- EasyCVR集群部署如何解决项目中的海量视频接入与大并发需求?
- Metasploit (MSF) uses MS17_ 010 (eternal blue) encoding:: undefined conversionerror problem
猜你喜欢

Depth first DFS and breadth first BFS -- traversing adjacency tables

链表之双指针(快慢指针,先后指针,首尾指针)

Spectrum analysis of ADC sampling sequence based on stm32

Postman核心功能解析-参数化和测试报告

傅里叶分析概述

Ieventsystemhandler event interface

點到直線的距離直線的交點及夾角

如何快速体验OneOS

Masked Autoencoders Are Scalable Vision Learners (MAE)

fibonacci search
随机推荐
The introduction to go language is very simple: String
一文搞定JVM常见工具和优化策略
APK加固技术的演变,APK加固技术和不足之处
Event trigger requirements of the function called by the event trigger
點到直線的距離直線的交點及夾角
终于搞懂什么是动态规划的
The code generator has deoptimised the styling of xx/typescript. js as it exceeds the max of 500kb
Damn, window in ie open()
[groovy] groovy dynamic language features (automatic type inference of function arguments in groovy | precautions for function dynamic parameters)
第一讲:蛇形矩阵
MCU case -int0 and INT1 interrupt count
Solve the problem of "no input file specified" when ThinkPHP starts
[error record] file search strategy in groovy project (src/main/groovy/script.groovy needs to be used in the main function | groovy script directly uses the relative path of code)
d3dx9_ What if 29.dll is missing? System missing d3dx9_ Solution of 29.dll file
二叉树(三)——堆排序优化、TOP K问题
如何快速体验OneOS
Global and Chinese markets for welding products 2022-2028: Research Report on technology, participants, trends, market size and share
[Chongqing Guangdong education] National Open University autumn 2018 0088-21t Insurance Introduction reference questions
Nangou Gili hard Kai font TTF Download with installation tutorial
Record several frequently asked questions (202207)