Server 1 redirects, Server 2 does not

This problem may have been around before I updated to nginx version
but I’m not sure.

I have one VPS with two IP addresses. Server 1 redirects port 80 www and
non-www to port 443 requests along with www requests on port 443 to the
non-www web site. iow, http://(www.) and
properly get 301 redirected to

Site 2 does not do this and only redirects http:// requests to the
equivalent https:// even though both server directives contain identical
directives though different ssl certs.

server {
return 301$request_uri;

server {
    listen ssl http2;

    http2_keepalive_timeout 64;
    keepalive_timeout 64;

This is identical for server 2 including the rest of the directives in
server block. My one question is whether the ssl cert for server2 may
not be
properly set up for the www name but I’m not sure.

Does something immediately jump out as the problem or where should I
further? Other than the redirection, everything on server2 works as it

Posted at Nginx Forum:

Note that I upgraded the server so I could turn httpv2 on.

Posted at Nginx Forum:

Doing a curl -I -L returns this:

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Fri, 21 Aug 2015 03:04:50 GMT
Content-Type: text/html
Content-Length: 178
Connection: keep-alive

HTTP/1.1 200 OK
Server: nginx
Date: Fri, 21 Aug 2015 03:04:50 GMT
Content-Type: text/html; charset=utf-8

Now I’m really confused. Using Chrome on my desktop and my phone, the
address bar shows

Posted at Nginx Forum: