当前位置:网站首页>Use the rewrite rule to rewrite all accesses to the a domain name to the B domain name
Use the rewrite rule to rewrite all accesses to the a domain name to the B domain name
2022-07-05 23:00:00 【wwzroom】
Use rewrite The rule implementation will all to a Access to domain names rewrite To b domain name
[[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 Follow the jump -v Show details )
* 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问题
- fibonacci search
- TCC of distributed solutions
- 【Note17】PECI(Platform Environment Control Interface)
- 第十七周作业
- audiopolicy
- 南京:全面启用商品房买卖电子合同
- Tensor attribute statistics
- Ultrasonic sensor flash | LEGO eV3 Teaching
- CJ mccullem autograph: to dear Portland
猜你喜欢
Codeforces Global Round 19
Unity Max and min constraint adjustment
[secretly kill little buddy pytorch20 days] - [Day2] - [example of picture data modeling process]
Vision Transformer (ViT)
a-tree 树的全部展开和收起
Simple and beautiful method of PPT color matching
第十七周作业
d3dx9_ How to repair 31.dll_ d3dx9_ 31. Solution to missing DLL
How can easycvr cluster deployment solve the massive video access and concurrency requirements in the project?
鏈錶之雙指針(快慢指針,先後指針,首尾指針)
随机推荐
d3dx9_ How to repair 31.dll_ d3dx9_ 31. Solution to missing DLL
【Note17】PECI(Platform Environment Control Interface)
audiopolicy
Editor extensions in unity
Usage Summary of scriptable object in unity
Selenium+Pytest自动化测试框架实战
Tensor attribute statistics
Element operation and element waiting in Web Automation
Distributed resource management and task scheduling framework yarn
How can easycvr cluster deployment solve the massive video access and concurrency requirements in the project?
Roman numeral to integer
Event trigger requirements of the function called by the event trigger
Ieventsystemhandler event interface
Paddy serving v0.9.0 heavy release multi machine multi card distributed reasoning framework
openresty ngx_ Lua regular expression
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
Marginal probability and conditional probability
Leetcode weekly The 280 game of the week is still difficult for the special game of the week's beauty team ~ simple simulation + hash parity count + sorting simulation traversal
[digital signal denoising] improved wavelet modulus maxima digital signal denoising based on MATLAB [including Matlab source code 1710]
分布式解决方案之TCC