对于新的站点配置,我尝试使用 NGINX 重写博客计划并保持路径不变,只是从“www.”重定向到“blog.”
并计划配置 RSpace API 和 CME 以及 ALB。
www.qwerty.com/video/ www.qwerty.com/v/
博客
www.qwerty.com/blog/category/educator-blog/
blog.qwerty.com/educator/
www.qwerty.com/blog/category/researcher-blog/
blog.qwerty.com/researcher/
www.qwerty.com/blog/category/librarian-blog/
blog.qwerty.com/librarian/
RSpace API
www.qwerty.com/api/external/
review.qwerty.com/api/external/
芝加哥商品交易所
www.qwerty.com/etc/cme_confirm.php
review.qwerty.com/etc/cme_confirm.php
所以我尝试了这个对于 nginx
# Redirect
server {
listen 80;
access_log off;
error_log off;
server_name www.qwerty.com/blog/category/educator-blog/;
return 301 $scheme://blog.qwerty.com/educator/$request_uri;
}
# Redirect
server {
listen 80;
access_log off;
error_log off;
server_name www.qwerty.com/blog/category/researcher-blog/;
return 301 $scheme://blog.qwerty.com/researcher/$request_uri;
}
# Redirect
server {
listen 80;
access_log off;
error_log off;
server_name www.qwerty.com/blog/category/librarian-blog/;
return 301 $scheme://blog.qwerty.com/librarian/$request_uri;
}
但它无法满足我们的要求,它似乎只是旋转,一个 URL(https://new-dev2.qwerty.com/video/49)。规则的顺序重要吗?
我已经通过负载平衡器实施了临时修复,以使“/video/”
with 'www.qwerty.com' redirected to review.qwery.com/,
IF
Path is/video*
Host is www.qwerty.com
THEN
Redirect tohttps://review.qwerty.com:443/#{path}?#{query}
Status code:HTTP_302
它允许 apache 重定向工作。但我正在寻找 NGINX 的参数修复。
输出
[root@ip-10-0-11-216 ~]# curl -I http://www.qwerty.com/blog/category/educator-blog/
HTTP/1.1 301 Moved Permanently
Server: awselb/2.0
Date: Mon, 10 Oct 2022 08:19:16 GMT
Content-Type: text/html
Content-Length: 134
Connection: keep-alive
Location: https://www.qwerty.com:443/blog/category/educator-blog/
这里的问题是什么?如能得到任何帮助,我们将不胜感激。