https auto redirect to specific port

Francis Daly francis at
Wed Oct 10 18:09:13 UTC 2018

On Wed, Oct 10, 2018 at 01:56:47PM -0400, c4rl wrote:

Hi there,

if I am reading this right, then what you describe and what the config
file you provide say, are different.

> The first vhost needs to listen on 8080 (https) and as you can see I'm using
> a redirect from http > https 8080. The second one is listening on 80.
> My problem is that if a user type https in the address bar instead of http
> it calls the second vhost. 

The config file says that if someone goes to, you will
(almost always) redirect them to

If someone goes to, they will go to port 443. And
you have no listener for port 443 in the config file that you show.

> How can redirect the to instead
> of when a user type https in the address bar?

Add a 443 listener-server block that does ssl and redirects to Or, probably, change the current 443
listener-server block to redirect to instead
of to

Francis Daly        francis at

More information about the nginx mailing list