Nginx重定向发送本地主机而不是服务器名称ip地址

Nginx重定向发送本地主机而不是服务器名称ip地址,nginx,centos,Nginx,Centos,我在CentOS 7上运行的nginx配置有问题。 我正在尝试将端口80上的http请求发送到443上的ssl端口,这两台服务器的设置如下: upstream backend { server 192.168.1.79:8080; } server { listen 80; #listen [::]:80; server_name TOTO02; #192.168.1.78 rewrite ^ https

我在CentOS 7上运行的nginx配置有问题。 我正在尝试将端口80上的http请求发送到443上的ssl端口,这两台服务器的设置如下:

upstream backend {
    server 192.168.1.79:8080;
}
    server {
         listen   80;
        #listen   [::]:80;
        server_name TOTO02; #192.168.1.78

        rewrite ^ https://CERVO02$request_uri;
    }

    server {

        listen 443 ssl spdy;
        server_name  TOTO02;
        ssl on;
        ssl_certificate      /etc/nginx/ssl/server.crt;
        ssl_certificate_key  /etc/nginx/ssl/server.key;

        #charset koi8-r;
        #access_log  /var/log/nginx/log/host.access.log  main;    


        location / {
            #root   /usr/share/nginx/html;
            #index  index.html index.htm;

           proxy_pass http://backend;# backend c'est pas une variable 

            proxy_cache my-test-cache;
            proxy_cache_valid  200 302  60m;
            proxy_cache_valid  404      1m;
            proxy_cache_use_stale   error timeout invalid_header updating;
            proxy_redirect default;
        }

我遇到的问题是,我从http服务器返回的url是
https://localhost/
问题是主机文件在两台服务器上都被正确设置。

发现了问题所在。我使用的chrome浏览器出现了以前的错误,但由于浏览器缓存,它保留了旧错误。有一次我用Internet Explorer测试了它,它工作正常,没有错误