如果我有一个使用Puppet管理的nginx服务器,我将如何使用nginx作为以hostname.com/api
开头的任何路径的代理,并将其转发到hostname.com:8000/api
?
服务器的示例puppet配置:
nginx::resource::server { "${site_name}":
listen_port => 80,
www_root => "/var/www/frontend",
ssl_redirect => false,
ssl => true,
ssl_cert => "/etc/letsencrypt/live/${site_name}/fullchain.pem",
ssl_key => "/etc/letsencrypt/live/${site_name}/privkey.pem",
ssl_port => 443,
}
我试过这个但它似乎没有工作(它仍然加载反应应用程序而不是来自django的api的前置模板)
nginx::resource::location{'/api':
server => $site_name,
ssl => true,
proxy => "https://localhost:8000",
}