当前位置:网站首页>使用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/
边栏推荐
- Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
- 如何快速体验OneOS
- Postman core function analysis - parameterization and test report
- Nail error code Encyclopedia
- 513. Find the value in the lower left corner of the tree
- Paddle Serving v0.9.0 重磅发布多机多卡分布式推理框架
- Metaverse ape ape community was invited to attend the 2022 Guangdong Hong Kong Macao Great Bay metauniverse and Web3.0 theme summit to share the evolution of ape community civilization from technology
- [speech processing] speech signal denoising based on Matlab GUI Hanning window fir notch filter [including Matlab source code 1711]
- Metasploit (MSF) uses MS17_ 010 (eternal blue) encoding:: undefined conversionerror problem
- Qtquick3d real time reflection
猜你喜欢
Vision Transformer (ViT)
Distance entre les points et les lignes
d3dx9_ How to repair 31.dll_ d3dx9_ 31. Solution to missing DLL
All expansion and collapse of a-tree
Leetcode daily question 1189 The maximum number of "balloons" simple simulation questions~
2022 Software Test Engineer salary increase strategy, how to reach 30K in three years
Lesson 1: serpentine matrix
基于STM32的ADC采样序列频谱分析
点到直线的距离直线的交点及夹角
链表之双指针(快慢指针,先后指针,首尾指针)
随机推荐
The difference between MVVM and MVC
700. Search in a Binary Search Tree. Sol
如何快速体验OneOS
抖音__ac_signature
Usage Summary of scriptable object in unity
Unity Max and min constraint adjustment
[groovy] groovy dynamic language features (automatic type inference of function arguments in groovy | precautions for function dynamic parameters)
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
Platformio create libopencm3 + FreeRTOS project
一文搞定垃圾回收器
[secretly kill little buddy pytorch20 days] - [Day2] - [example of picture data modeling process]
2022.02.13 - SX10-30. Home raiding II
Practice: fabric user certificate revocation operation process
Distance entre les points et les lignes
航海日答题小程序之航海知识竞赛初赛
链表之双指针(快慢指针,先后指针,首尾指针)
The code generator has deoptimised the styling of xx/typescript. js as it exceeds the max of 500kb
Depth first DFS and breadth first BFS -- traversing adjacency tables
Global and Chinese market of water treatment technology 2022-2028: Research Report on technology, participants, trends, market size and share
SPSS analysis of employment problems of college graduates