https到http为旧程序

时间:2018-02-13 13:29:32

标签: nginx https nginx-reverse-proxy

(对不起,英文不好)

我有一个旧的软件,可以调用网页。 但它不能调用https-pages,只能调用http。 我的nginx.conf for nginx:

worker_processes  1;
events {worker_connections  1024;}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    #------------------
    # from me:
    server {
       server_name localhost; listen 30001;
       set $x https://www.example1.com/downloads;
       location / { proxy_pass $x; }
    }
    server {
       server_name localhost; listen 30002;
       set $x https://www.example2.com/news;
       location / { proxy_pass $x; }
    }
    ...
    #------------------

    server {
        listen 80;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {root html;}
    }
}

然后在我可以使用的软件中:

http://localhost:30001  ->  calls https://www.example1.com/downloads
http://localhost:30002  ->  calls https://www.example2.com/news

缺点: 我必须写一个服务器{} - 阻止每个https-网页进入nginx.conf。

是否可以为所有https-webpages执行https-> http?

非常感谢您的帮助。

0 个答案:

没有答案