欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

nginx配置文件 http 强跳转 https

程序员文章站 2023-01-16 11:31:00
server { listen 80; server_name www.xxxx.com; if ($host = "www.xxxx.com"){ return 301 https://www.xxxx.com$request_uri; } } ......
server {
  listen       80;
  server_name  www.xxxx.com;

  if ($host = "www.xxxx.com"){
    return 301 https://www.xxxx.com$request_uri;
  }

}