这里的情况。
example.com服务器,服务于80或端口取决于用户的select。
这个服务器将被移到一个Nginx的实例之后,它将作为反向代理(和负载均衡器),并相应地提供HTTP和HTTPS。
注意:
问题是,到目前为止,我所遇到的所有例子都是在http和https在不同子域中服务的情况下处理的
server_name www.example.com;
和
server_name secure.example.com;
问题是,这种情况下的configuration是什么?
由于你的SSL方面不会在同一个虚拟主机configuration,你将需要在两个单独的服务器configuration指令。
你应该可以做类似的事情
server { listen 80 default; server_name example.com _; .... } server { listen 443 default; server_name example.com _; .... }
由于您有两个独立的侦听端口,您将能够拥有多个相同虚拟主机名称的实例 – 每个端口一个(80为http,443为https)
您可能需要考虑在两个服务器{}指令之间使用一个包含常用configuration的include,以便您不必在文件中重复您的configuration
例如
server { listen 80 default; include /etc/nginx/conf/common.conf; } server { listen 443 default; include /etc/nginx/conf/common.conf; }