将非.onion重定向到https,但将.onion保留为http?

时间:2018-11-23 21:28:42

标签: nginx tor

我要在网站上添加.onion地址,并且需要将常规流量重定向到https和.onion流量,以保持为http。我有:

if ($scheme != "https") {
  if ($host !~* "\.onion$") { # error occurs here
    return 301 https://$host$request_uri;
  }
}

我收到以下错误:

nginx: [emerg] "if" directive is not allowed here in nginx.conf:22

0 个答案:

没有答案