当前位置:网站首页>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/
边栏推荐
- Global and Chinese markets for reciprocating seal compressors 2022-2028: Research Report on technology, participants, trends, market size and share
- Why does the C# compiler allow an explicit cast between IEnumerable&lt; T&gt; and TAlmostAnything?
- d3dx9_ How to repair 31.dll_ d3dx9_ 31. Solution to missing DLL
- 链表之双指针(快慢指针,先后指针,首尾指针)
- TOPSIS code part of good and bad solution distance method
- d3dx9_ What if 29.dll is missing? System missing d3dx9_ Solution of 29.dll file
- 关于MySQL的30条优化技巧,超实用
- Three.js-01 入门
- 2022 Software Test Engineer salary increase strategy, how to reach 30K in three years
- The difference between MVVM and MVC
猜你喜欢
Paddy serving v0.9.0 heavy release multi machine multi card distributed reasoning framework
Vision Transformer (ViT)
Simple and beautiful method of PPT color matching
Alibaba Tianchi SQL training camp task4 learning notes
d3dx9_ What if 29.dll is missing? System missing d3dx9_ Solution of 29.dll file
利用LNMP实现wordpress站点搭建
Distributed resource management and task scheduling framework yarn
Exponential weighted average and its deviation elimination
audiopolicy
Double pointeur de liste liée (pointeur rapide et lent, pointeur séquentiel, pointeur de tête et de queue)
随机推荐
南京:全面启用商品房买卖电子合同
一文搞定class的微观结构和指令
Nacos installation and service registration
鏈錶之雙指針(快慢指針,先後指針,首尾指針)
Binary tree (III) -- heap sort optimization, top k problem
VOT Toolkit环境配置与使用
一文搞定JVM常见工具和优化策略
从 1.5 开始搭建一个微服务框架——日志追踪 traceId
一文搞定class的微觀結構和指令
媒体查询:引入资源
Starting from 1.5, build a micro Service Framework -- log tracking traceid
Paddle Serving v0.9.0 重磅发布多机多卡分布式推理框架
Douban scoring applet Part-2
First, redis summarizes the installation types
[speech processing] speech signal denoising based on Matlab GUI Hanning window fir notch filter [including Matlab source code 1711]
Getting started stm32--gpio (running lantern) (nanny level)
MoCo: Momentum Contrast for Unsupervised Visual Representation Learning
APK加固技术的演变,APK加固技术和不足之处
Lesson 1: serpentine matrix
[screen recording] how to record in the OBS area