Redirect HTTP to HTTPS in NGINX

Redirect HTTP to HTTPS in NGINX

Change nginx configuration file as below

server {
    listen       80 default_server;
    server_name  www.bianxi.com;

    return 301 https://$host$request_uri;
}

Note: Use default_server for only one server for each port.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


The reCAPTCHA verification period has expired. Please reload the page.