Nginx uses rewrite to achieve mandatory jump https

If ($scheme = http) { 
Rewrite ^(.*) https://$server_name$1 permanent;
 }

The above code can be directly put into the rewrite rule given by the host.

among them
 Scheme #HTTP method (such as http, https)
 $1 permanent #Rules for http://domains/xxx Jump to https://domains/xxx
  • 30 Users Found This Useful
Was this answer helpful?

Related Articles

How to choose the cloud server?

★ Choose the right cloud server configuration based on your actual business needs: Understand...

How do I connect to my cloud server? (including linux and windows)

First of all to distinguish between linux and windows, including ubuntu, centos, debian are...

linux system data disk merged into the system disk

 Check it out, the current command: df -h [[email protected] ~]# df -h Filesystem...

Linux cloud server data disk expansion tutorial guide

This tutorial belongs to the data disk expansion [non-system disk] default directory /dev/sdb...

About the automatic synchronization of cloud server time, and the problem that time cannot be modified.

Recently, there have been user feedback, cloud server time cannot be modified. The solution is...