如何使用侍应生为烧瓶应用程序正确配置NGNIX for SSL

问题描述

我有一个简单的烧瓶应用程序,正在使用侍应生/ nginx服务/托管

这些规则可以与SSL一起正常工作

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    include snippets/number2.conf;
    include snippets/ssl-params.conf;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name https://exanple.com;
        location / {

            proxy_pass http://example.com:5000/;
            proxy_set_header X-Real-IP $remote_addr;


        }

}


server {
    listen 80;
    listen [::]:80;

    server_name domain;

    return 302 https://$server_name$request_uri;
}

但是,这些服务与女服务员/ nginx的应用程序无法正常工作。请注意,该服务器还在端口8069上运行另一个应用程序。

    server {
    
        listen 443 ssl;
        listen [::]:443 ssl;
        include snippets/self-signed.conf;
        include snippets/ssl-params.conf;
    
    
           
    
            root /var/www/html;
        
    
            server_name ip.adress;
            rewrite ^/$ https://ip.adress;
    
    location / {
            proxy_pass http://ip.adress:8069;
            }
    
    
    }
    
    server {
        listen 80;
        listen [::]:80;
    
        server_name ip.adress;
            return 301 https://ip.adress$request_uri;
    
    
    }



server {
    listen 443 ssl;
    listen [::]:443 ssl;
    include snippets/number2.conf;
    include snippets/ssl-params.conf;

        root /var/www/html;

        index index.html index.htm index.nginx-debian.html;

        server_name https:/example.com;
        location / {

            proxy_pass http://example.com:5000/;
            proxy_set_header X-Real-IP $remote_addr;


        }

}


server {
    listen 80;
    listen [::]:80;

    server_name domain.com;

    return 302 https://$server_name$request_uri;
}

尝试过多种服务器规则组合,但此时我迷路了。

解决方法

下面的proxy_pass http://ip.adress:5000;location /中的主要重要行,以使所有内容正常工作吗?

,

我能够弄清楚。对于其他遇到麻烦的人,我不得不使用反向代理。我listened to port 8001used a proxy port 5000header of Host $host。我还向烧瓶应用添加了url_scheme='https'

https://docs.pylonsproject.org/projects/waitress/en/stable/reverse-proxy.html

    server {

    listen ip.adress:8001 ssl;
    include snippets/ssl-self.conf;
    include snippets/ssl-params.conf;



        root /var/www/html;



        index index.html index.htm index.nginx-debian.html;

        server_name ip.adress;

location / {
        proxy_pass http://ip.adress:5000;
        proxy_set_header        Host $host;

        }
}

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...