项目参考:
https://github.com/fanyinghao/nginx-docker-miniprogram

www.conf

server {
    listen 443 ssl http2;
    server_name  api.wecode.net.cn;

    #ssl                      on;
    ssl_certificate          /etc/nginx/certs/api.wecode.net.cn_bundle.crt;
    ssl_certificate_key      /etc/nginx/certs/api.wecode.net.cn.key;

    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;

    location ~* \.(?:css|js|ttf|woff|svg|ico|png|jpg)$ {
        proxy_set_header Accept-Encoding "";
        proxy_set_header Referer "https://www.fifaofficial.cn/";
        proxy_pass http://cdn.fifaofficial.cn/$request_uri;

        add_header Access-Control-Allow-Origin *;

        sub_filter 'cdn.fifaofficial.cn' 'api.wecode.net.cn';
        sub_filter 'www.fifaofficial.cn' 'api.wecode.net.cn';
        sub_filter 'api.fifa.com' 'api.wecode.net.cn';
        sub_filter_types text/css text/xml text/html text/javascript application/javascript application/json;
        sub_filter_once off;
    }

    location ^~ /api/v1/ {
        proxy_set_header Accept-Encoding "";
        proxy_set_header Referer "https://www.fifaofficial.cn/";
        proxy_pass http://api.fifa.com/$request_uri;

        add_header Access-Control-Allow-Origin *;

        sub_filter 'cdn.fifaofficial.cn' 'api.wecode.net.cn';
        sub_filter 'api.fifa.com' 'api.wecode.net.cn';
        sub_filter_types text/css text/xml text/html text/javascript application/javascript application/json;
        sub_filter_once off;
    }

    location ^~ /v1/ {
        proxy_set_header Accept-Encoding "";
        proxy_set_header Referer "https://www.fifaofficial.cn/";
        proxy_pass http://www.fifaofficial.cn/$request_uri;

        add_header Access-Control-Allow-Origin *;

        sub_filter 'cdn.fifaofficial.cn' 'api.wecode.net.cn';
        sub_filter 'api.fifa.com' 'api.wecode.net.cn';
        sub_filter_types text/css text/xml text/html text/javascript application/javascript application/json;
        sub_filter_once off;
    }

    location ^~ /media/ {
        proxy_set_header Accept-Encoding "";
        proxy_set_header Referer "https://www.fifaofficial.cn/";
        proxy_pass http://cdn.fifaofficial.cn/$request_uri;

        add_header Access-Control-Allow-Origin *;
    }

    location ^~/ {
        proxy_set_header Accept-Encoding "";
        proxy_set_header Referer "https://www.fifaofficial.cn/";
        proxy_pass http://www.fifaofficial.cn/;

        add_header Access-Control-Allow-Origin *;

        sub_filter 'cdn.fifaofficial.cn' 'api.wecode.net.cn';
        sub_filter 'www.fifaofficial.cn' 'api.wecode.net.cn';
        sub_filter 'api.fifa.com' 'api.wecode.net.cn';
        sub_filter_types text/css text/xml text/html text/javascript application/json application/javascript;
        sub_filter_once off;
    }
}