当前位置:网站首页>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/
边栏推荐
- All expansion and collapse of a-tree
- Starting from 1.5, build a micro Service Framework -- log tracking traceid
- Common model making instructions
- TCC of distributed solutions
- 我对新中台模型的一些经验思考总结
- Selenium+pytest automated test framework practice
- 一文搞定class的微观结构和指令
- Solve the problem of "no input file specified" when ThinkPHP starts
- Google Maps case
- Element positioning of Web Automation
猜你喜欢
南京:全面启用商品房买卖电子合同
TypeError: this. getOptions is not a function
Google Maps case
Finally understand what dynamic planning is
Spectrum analysis of ADC sampling sequence based on stm32
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
Vcomp110.dll download -vcomp110 What if DLL is lost
Element operation and element waiting in Web Automation
Registration of Electrical Engineering (elementary) examination in 2022 and the latest analysis of Electrical Engineering (elementary)
Alibaba Tianchi SQL training camp task4 learning notes
随机推荐
Openresty ngx Lua regular expression
Global and Chinese market of water treatment technology 2022-2028: Research Report on technology, participants, trends, market size and share
[screen recording] how to record in the OBS area
链表之双指针(快慢指针,先后指针,首尾指针)
d3dx9_ What if 29.dll is missing? System missing d3dx9_ Solution of 29.dll file
Binary tree (III) -- heap sort optimization, top k problem
VOT toolkit environment configuration and use
Thinkphp5.1 cross domain problem solving
The introduction to go language is very simple: String
基于STM32的ADC采样序列频谱分析
The code generator has deoptimised the styling of xx/typescript.js as it exceeds the max of 500kb
[speech processing] speech signal denoising based on Matlab GUI Hanning window fir notch filter [including Matlab source code 1711]
Selenium+Pytest自动化测试框架实战
查看网页最后修改时间方法以及原理简介
利用LNMP实现wordpress站点搭建
Expectation, variance and covariance
Ieventsystemhandler event interface
我把开源项目alinesno-cloud-service关闭了
Nacos 的安装与服务的注册
Nanjing: full use of electronic contracts for commercial housing sales