我有 7 个服务。我希望它们自动转发 http->https。
我正在尝试这个,但是没有用:
map $http_host $backend {
apples.example.com http://127.0.0.1:3006;
oranges.example.com http://127.0.0.1:3000;
bananas.example.com http://127.0.0.1:3010;
pears.example.com http://127.0.0.1:3012;
dragonfruit.example.com http://127.0.0.1:3014;
peaches.example.com http://127.0.0.1:3002;
tomatos.example.com http://127.0.0.1:3016;
}
# All services (except button) forward HTTP -> HTTPS
server {
listen 80;
return 307 https://$http_host$request_uri;
}
我误解了一些东西,因为其中一项服务不匹配。
http://apples.example.com
正在转发至https://peaches.example.com
我正在运行这个来测试:
sudo service nginx restart && wget http://apples.example.com/ --no-check-certificate
它又回来了:
--2016-10-05 20:07:37-- http://apples.example.com/
Resolving expert-dev.bigsmall.io (apples.example.com)... 127.0.0.1
Connecting to expert-dev.bigsmall.io (apples.example.com)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 307 Temporary Redirect
Location: https://peaches.example.com [following]
--2016-10-05 20:07:37-- https://peaches.example.com/
nginx 版本:nginx/1.10.0(Ubuntu)
有什么建议么?