Nginx:http Jump HTTPS

Source: Internet
Author: User
Tags nginx server

Reference: Blog

Reference: HTTP Status Code Interpretation

Nginx-rewrite Way

Nginx Server Configuration

server {      listen  ;      server_name www.test.com test.com;     ^ (. *) $  https://$host $ permanent;   } server {      listen       443  SSL;    server_name  www.ourdax.com;       Ssl_certificate      /usr/local/openresty/nginx/conf/ssl/Test.pem;     Ssl_certificate_key  /usr/local/openresty/nginx/conf/ssl/test.key;       /usr/local/openresty/nginx/html;    Index index.html;     / {    }    }


Nginx-Status Code 497

About Nginx Status Code 497

497-normal request was sent to HTTPS

When this virtual site only allows HTTPS access, Nginx will report a 497 error code when accessed with HTTP

Realize Jump thinking

Use the error_page command to redirect the link of the 497 status code to the specified URL

Nginx Server Configuration

server {      listen       443  SSL;      Listen       ;     server_name  www.test.com;       Ssl_certificate      /usr/local/openresty/nginx/conf/ssl/Test.pem;     Ssl_certificate_key  /usr/local/openresty/nginx/conf/ssl/test.key;           /usr/local/openresty/nginx/html;    Index index.html;      / {            }          497  https://$host $uri? $args;  

Summarize

About the original blog in the HTML in the way of the refresh to do the jump way I do not very much agree, or to the Web server to handle these things better.

Nginx:http Jump HTTPS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.