【问题标题】:Meteor, prerender.io, Nginx and SSLMeteor、prerender.io、Nginx 和 SSL
【发布时间】:2016-05-19 15:59:13
【问题描述】:

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

我做了类似以下的事情: 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

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

【问题讨论】:

标签: ssl meteor nginx prerender


【解决方案1】:

错误意味着proxy_http_version 指令不允许在if 块内使用。 documentation 为每个指令指定一个 context。例如,proxy_pass 指令 允许在 if 块内使用。

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

proxy_http_version ...;
proxy_... ...;

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

请注意ifcomes with a caution的使用。

【讨论】:

    猜你喜欢
    • 2018-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-12
    • 1970-01-01
    • 1970-01-01
    • 2015-05-18
    • 1970-01-01
    相关资源
    最近更新 更多