我必须将使用 RewriteCond 和 RewriteRule 的 Apache 反向代理配置转换为 Nginx。
我怎样才能将这样的东西转换为 nginx 配置?
(这是在主要/唯一的<VirtualHost *:443>
块)
RewriteCond %{HTTP_HOST} ^stagingapi$ [NC]
RewriteRule ^/(.*) https://staging-zone.mydomain.com/$1 [R,L]
我必须将使用 RewriteCond 和 RewriteRule 的 Apache 反向代理配置转换为 Nginx。
我怎样才能将这样的东西转换为 nginx 配置?
(这是在主要/唯一的<VirtualHost *:443>
块)
RewriteCond %{HTTP_HOST} ^stagingapi$ [NC]
RewriteRule ^/(.*) https://staging-zone.mydomain.com/$1 [R,L]
RewriteRule 的第一个参数正则表达式与所有以开头的 URI 匹配
/
,第二个参数是替换,它将“stagingapi”站点(R 标志)重定向到https://staging-zone.mydomain.com/尝试类似的东西:
如果你想一直重定向到 HTTPS 以具有与在 apache 中相同的行为,你可以替换
$scheme
为。https