重定向到compute.amazonaws.com

时间:2017-04-24 13:42:31

标签: nginx amazon-ec2

我在基本的AWS EC2实例上运行nginx。

我的nginx http服务器块如下所示:

server {
    listen       80 default_server;
    listen       [::]:80;

    # TLS redirect
    server_name ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com;
    return 301 https://$host$request_uri;
}

我的https服务器块工作正常,所以当我输入:

https://ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com

在我的浏览器中,一切正常,但是当我输入时:

http://ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com (http, not https)

我被重定向到

https://compute.amazonaws.com

这有什么明显的原因吗?提前谢谢。

使用curl编辑

[ec2-user@ip-xxx-xx-xx-xxx ~]$ curl -v http://ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com
* Rebuilt URL to: http://ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com/
*   Trying 172.31.14.246...
* TCP_NODELAY set
* Connected to ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com (xxx.xx.xx.xxx) port 80 (#0)
> GET / HTTP/1.1
> Host: ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com
> User-Agent: curl/7.51.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.10.2
< Date: Mon, 24 Apr 2017 22:09:39 GMT
< Content-Type: text/html
< Content-Length: 185
< Connection: keep-alive
< Location: https://ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com
< 
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
* Curl_http_done: called premature == 0
* Connection #0 to host ec2-xx-xx-xxx-xxx.rr-rrrr-r.compute.amazonaws.com left intact

0 个答案:

没有答案