当前位置:网站首页>使用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/
边栏推荐
- VOT toolkit environment configuration and use
- 一文搞定垃圾回收器
- Codeforces Global Round 19
- Damn, window in ie open()
- 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
- Shelved in TortoiseSVN- Shelve in TortoiseSVN?
- 记录几个常见问题(202207)
- Practice: fabric user certificate revocation operation process
- The difference between MVVM and MVC
- [speech processing] speech signal denoising and denoising based on Matlab GUI low-pass filter [including Matlab source code 1708]
猜你喜欢

Nangou Gili hard Kai font TTF Download with installation tutorial

2022 Software Test Engineer salary increase strategy, how to reach 30K in three years

基于STM32的ADC采样序列频谱分析

航海日答题小程序之航海知识竞赛初赛

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

Usage Summary of scriptable object in unity

d3dx9_ What if 29.dll is missing? System missing d3dx9_ Solution of 29.dll file

How to quickly experience oneos

90后测试员:“入职阿里,这一次,我决定不在跳槽了”

Metaverse Ape上线倒计时,推荐活动火爆进行
随机推荐
一文搞定JVM常见工具和优化策略
2022.02.13 - SX10-30. Home raiding II
Global and Chinese markets for children's amusement facilities 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of diesel fire pump 2022-2028: Research Report on technology, participants, trends, market size and share
Common model making instructions
MCU case -int0 and INT1 interrupt count
audiopolicy
Binary tree (III) -- heap sort optimization, top k problem
Unity Max and min constraint adjustment
Codeforces Global Round 19
谷歌地图案例
APK加固技术的演变,APK加固技术和不足之处
Global and Chinese markets of tantalum heat exchangers 2022-2028: Research Report on technology, participants, trends, market size and share
一文搞定class的微观结构和指令
如何创建线程
Metaverse Ape上线倒计时,推荐活动火爆进行
Google Maps case
Exponential weighted average and its deviation elimination
3 find the greatest common divisor and the least common multiple
Distance from point to line intersection and included angle of line