search

Home  >  Q&A  >  body text

About the problem of Nginx forcing to jump to HTTPS

I checked it on the Internet, and one of them said this:

Excuse me https://$host$1 permanent;What do $host$1 and permanent here mean?


I just checked on Baidu, $host is the requested host name, $1 is the first matching result, and permanent should be the permanent orientation.

But there are multiple servers in my conf file bound to different domain names. Will this affect the value of $host?


I just added this rewrite sentence to the configuration file. After reloading, HTTP did not jump to HTTPS. I will try to see what went wrong.


Done, just replace $host with the domain name

 rewrite ^(.*)$  https://www.test.com permanent; 
给我你的怀抱给我你的怀抱2810 days ago510

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:10:12

    It’s done, just replace $host with the domain name

    rewrite ^(.*)$ https://www.test.com permanent;

    reply
    0
  • Cancelreply