当前位置:网站首页>使用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/
边栏推荐
- Nangou Gili hard Kai font TTF Download with installation tutorial
- 如何创建线程
- Global and Chinese markets for reciprocating seal compressors 2022-2028: Research Report on technology, participants, trends, market size and share
- How to quickly experience oneos
- Starting from 1.5, build a micro Service Framework -- log tracking traceid
- VIM tail head intercept file import
- Solve the problem of "no input file specified" when ThinkPHP starts
- 二叉树(三)——堆排序优化、TOP K问题
- 700. Search in a Binary Search Tree. Sol
- The difference between MVVM and MVC
猜你喜欢

Event trigger requirements of the function called by the event trigger

Common model making instructions
![[groovy] mop meta object protocol and meta programming (Introduction to groovyobject interface | introduction to metaclass | implementation of class methods using groovyobject invokemethod)](/img/48/cd7960bbbc51a967b20da410bf81fe.jpg)
[groovy] mop meta object protocol and meta programming (Introduction to groovyobject interface | introduction to metaclass | implementation of class methods using groovyobject invokemethod)

Paddy serving v0.9.0 heavy release multi machine multi card distributed reasoning framework

audiopolicy

Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程

EasyCVR集群部署如何解决项目中的海量视频接入与大并发需求?

VOT Toolkit环境配置与使用

點到直線的距離直線的交點及夾角

一文搞定垃圾回收器
随机推荐
[speech processing] speech signal denoising and denoising based on MATLAB low-pass filter [including Matlab source code 1709]
如何快速体验OneOS
VOT toolkit environment configuration and use
一文搞定class的微观结构和指令
2022 Software Test Engineer salary increase strategy, how to reach 30K in three years
I closed the open source project alinesno cloud service
[untitled]
Usage Summary of scriptable object in unity
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
第一讲:蛇形矩阵
TCC of distributed solutions
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
Boring boring
Binary tree (III) -- heap sort optimization, top k problem
MoCo: Momentum Contrast for Unsupervised Visual Representation Learning
如何创建线程
Tensor attribute statistics
Function default parameters, function placeholder parameters, function overloading and precautions
Metasploit (MSF) uses MS17_ 010 (eternal blue) encoding:: undefined conversionerror problem
Nacos 的安装与服务的注册