Meteor, prerender.io, Nginx and SSL



我正在尝试让prerender.io为我的Meteor应用程序使用Nginx配置,但不确定如何集成它。

我做了类似于以下的事情:https://www.digitalocean.com/community/questions/how-to-setup-prerender-io-on-my-mean-stack-application-running-behind-nginx

通过将http代理内容放在部分:

if ($prerender = 0) {
    #the directives
}

但问题是:

nginx: [emerg] "proxy_http_version" directive is not allowed here in /etc/nginx/sites-enabled/annachristoffer:48
nginx: configuration file /etc/nginx/nginx.conf test failed

已经被困了一段时间,似乎无法在网上找到解释它的来源。

此错误表示不允许在if块内部使用proxy_http_version指令。文档为每个指令指定了上下文。例如,允许在if块内部使用proxy_pass指令

许多nginx指令都可以从外部块继承,因此您可以像这样重组配置:

proxy_http_version ...;
proxy_... ...;
if ($prerender = 0) {
    ...;
    proxy_pass ...;
}

请注意,使用if时要小心。

最新更新