[英]Add rewrite location with Puppet / Nginx
我想在 Nginx 配置文件中使用此规则:
# Redirect old application
if ($host ~ (\w+).domain.com) {
set $root $1;
}
# Redirect old application
if ($host = app1.domain.com) {
rewrite ^ $scheme://app2.domain.com permanent;
}
但我无法弄清楚如何使用标准Nginx 模块将其传输到人偶
Puppet nginx
模块具有将任意原始文本附加到位置和服务器部分的属性。 例如,请参阅nginx::resource::location
清单以获取其完整的属性列表,其中包括raw_append
。
理论上,您的配置可以像这样简单
include nginx
nginx::resource::location { 'example.com/path/'
ensure => present,
location => '/path/',
server => 'example.com',
raw_append => @(END),
# Redirect old application
if ($host ~ (\w+).domain.com) {
set $root $1;
}
# Redirect old application
if ($host = app1.domain.com) {
rewrite ^ $scheme://app2.domain.com permanent;
}
END
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.