nginx重定向到相同的URL

时间:2018-11-14 00:11:37

标签: nginx devops nginx-config

我将nginx配置为以下代码

ssl_certificate  example.crt;
ssl_certificate_key example.key;

server {
    listen 80;
    server_name www.example.com example.com;
    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl;
    server_name example.com;
    return 200 hello;
}

我希望以200的价格得到curl -I https://example.com,但它给了我301

curl -I http://example.com => HTTP/1.1 301 Moved Permanently
location===https://example.com

curl -I https://example.com => HTTP/2 301
location===https://example.com

curl -I https://example.com/asdasd => HTTP/2 301  
location===https://example.com/asdasd

任何帮助将不胜感激。预先感谢。

0 个答案:

没有答案