Skip to content

解决http利用nginx重定向至https的问题

解决http利用nginx重定向至https的问题

  • what: 如何只让https访问网站,禁止http访问,若以http访问,默认会跳转至https访问
  • where: nginx
  • when: 2022.5.30
  • who: jrt
  • why: 记录
  • how:

nginx配置

server {
        listen 80 default backlog=2048;                                                                  
        server_name  www.jrt.top;
    return 301 https://$server_name$request_uri;
}