当前位置:网站首页>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/
边栏推荐
- [speech processing] speech signal denoising based on Matlab GUI Hanning window fir notch filter [including Matlab source code 1711]
- Record several frequently asked questions (202207)
- LeetCode102. Sequence traversal of binary tree (output by layer and unified output)
- Global and Chinese markets for welding products 2022-2028: Research Report on technology, participants, trends, market size and share
- 2022.02.13 - SX10-30. Home raiding II
- d3dx9_ How to repair 31.dll_ d3dx9_ 31. Solution to missing DLL
- 2022 Software Test Engineer salary increase strategy, how to reach 30K in three years
- Element operation and element waiting in Web Automation
- 南京:全面启用商品房买卖电子合同
- 2022 R2 mobile pressure vessel filling review simulation examination and R2 mobile pressure vessel filling examination questions
猜你喜欢
Leetcode daily question 1189 The maximum number of "balloons" simple simulation questions~
Metaverse ape received $3.5 million in seed round financing from negentropy capital
Matlab smooth curve connection scatter diagram
利用LNMP实现wordpress站点搭建
How can easycvr cluster deployment solve the massive video access and concurrency requirements in the project?
2022 G3 boiler water treatment simulation examination and G3 boiler water treatment simulation examination question bank
Postman core function analysis - parameterization and test report
The method and principle of viewing the last modification time of the web page
Alibaba Tianchi SQL training camp task4 learning notes
Element operation and element waiting in Web Automation
随机推荐
[untitled]
Hcip day 12 (BGP black hole, anti ring, configuration)
npm ELECTRON_ Mirror is set as domestic source (npmmirror China mirror)
Thoroughly understand JVM class loading subsystem
Commonly used probability distributions: Bernoulli distribution, binomial distribution, polynomial distribution, Gaussian distribution, exponential distribution, Laplace distribution and Dirac delta d
TypeError: this. getOptions is not a function
Solve the problem of "no input file specified" when ThinkPHP starts
关于MySQL的30条优化技巧,超实用
openresty ngx_lua请求响应
二叉树(三)——堆排序优化、TOP K问题
Metaverse ape received $3.5 million in seed round financing from negentropy capital
Roman numeral to integer
VOT toolkit environment configuration and use
Binary tree (II) -- code implementation of heap
从 1.5 开始搭建一个微服务框架——日志追踪 traceId
Leetcode daily question 1189 The maximum number of "balloons" simple simulation questions~
APK加固技术的演变,APK加固技术和不足之处
First, redis summarizes the installation types
谷歌地图案例
a-tree 树的全部展开和收起