server {

    # 将这里的域名改成自己的域名
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name api.mall4j.com;

    # 这一段是公有的ssl，需要将证书改成自己申请的证书 crt或pem格式的都可以
    ssl_certificate /ssl/4664402_mall4j.com.crt;
    ssl_certificate_key /ssl/4664402_mall4j.com.key;
    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;
    ssl_session_tickets off;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;
    location / {
        # 8000端口是网关启动的端口
        proxy_pass http://192.168.193.128:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";

        add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
        proxy_cookie_path / "/; httponly; secure; SameSite=Lax";
        # 如果觉得有必要的话，可以增加Content-Security-Policy，不过里面的域名要自己确定增加哪些
        # add_header Content-Security-Policy "default-src 'self'; style-src 'self';script-src 'self';font-src 'self';";
    }
}

