How nginx proxies https to http or locally (127.0.0.1)

problem description

the URL must be https when debugging Mini Program web-view. How to agent https locally.

Web development

my usual http web page development is to modify the hosts file and proxy the domain name xx.xxx.com to the local 127.0.0.1
Local is the vue project started by webpack. The local port for vue project listening is 80

when Mini Program developed web-view

how to proxy to a local vue project when debugging https URLs now.

ideas

want to use nginx proxy, how do I configure it?

Environment macos

nginx has been installed

Jul.12,2021

http://wproxy.org/whistle/web.


has been resolved.
nginx configuration.

server {
        listen       443 ssl;
        server_name  www.****.com;

        ssl on;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;

        ssl_certificate ./https/214319235880580.pem;
        ssl_certificate_key ./https/214319235880580.key;

        location / {
        -sharp   root   html;
        -sharp   index  index.html index.htm;
            proxy_pass http://www.****.com;
        }
        location /server/ {
            client_max_body_size    0;
            proxy_connect_timeout 300s;
            proxy_send_timeout   900;
            proxy_read_timeout   900;
            proxy_buffer_size    32k;
            proxy_buffers      4 32k;
            proxy_busy_buffers_size 64k;
            proxy_redirect     off;
            proxy_hide_header  Vary;
            proxy_set_header   Accept-Encoding '';
            proxy_set_header   Host   $host;
            proxy_set_header   Referer $http_referer;
            proxy_set_header   Cookie $http_cookie;
            proxy_set_header   X-Real-IP  $remote_addr;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_headers_hash_max_size 51200;
            proxy_headers_hash_bucket_size 6400;
            proxy_pass http://**.**.**.***:10103/;
     }
Menu