1.创建配置文件,新增如下配置

server {
  listen 80 default_server;
  listen 443 ssl default_server;
  server_name _;
  ssl_certificate /www/server/panel/vhost/cert/test.com/fullchain.pem;
  ssl_certificate_key /www/server/panel/vhost/cert/test.com/privkey.pem;
  #return 403;
  #rewrite ^(.*) https://test.com permanent;
  error_page 497 https://$host$request_uri;
  # if ($server_port !~ 443){
  # rewrite ^(/.*)$ https://$host$1 permanent;
  # }
  location / {
    root html;
    ndex game.html;
  }
  access_log /logs/forbidden.test.com.log main;
}

2.重启NGINX

nginx -t
nginx -s reload