Multiple HTTP2 reverse proxy support ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple HTTP2 reverse proxy support ?

sonpg
Hello


I'm trying to configure a reverse proxy for multiple domains with a single
nginx server.

Is that possible

eg.

<Clients> ----[HTTP 2.0]-->   < Nginx >   ---[HTTP 1.1]--- > <OriginServer>

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,277698,277698#msg-277698

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Multiple HTTP2 reverse proxy support ?

Руслан Закиров
Why not?

    server {
        listen       80; 
        server_name  localhost;
        location / { 
            alias /Users/ruz/projs/localhost/;
        }
    }
    server {
        listen       80; 
        server_name  example.com;
        location / { 
            proxy_pass ...;
        }
    }
    server {
        listen       80; 
        server_name  example.ru;
        location / {
            proxy_pass ...;
        }
    }


On Fri, Dec 8, 2017 at 9:18 AM, carrotis <[hidden email]> wrote:
Hello


I'm trying to configure a reverse proxy for multiple domains with a single
nginx server.

Is that possible

eg.

<Clients> ----[HTTP 2.0]-->   < Nginx >   ---[HTTP 1.1]--- > <OriginServer>

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,277698,277698#msg-277698

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx



--
Руслан Закиров
Руководитель отдела разработки веб-сервисов
+7(916) 597-92-69, ruz @ 

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Multiple HTTP2 reverse proxy support ?

sonpg
In reply to this post by sonpg
It's possible.

#put this in the http context
proxy_http_version 1.1; #default is HTTP/1.0

-

#example server blocks
#redirect to https
server {
    listen 80;
    server_name "~^(.+\.)?example\d{2}\.com$"; #regex to match
example[number].com and *.example[number].com
    return 301 https://$host$request_uri;
}

#https
#example01.com
server {
    listen 443 ssl http2;
    server_name  example01.com;

    proxy_pass http://10.0.2.2;

    #your config;
}

#foo.example01.com
server {
    listen 443 ssl http2;
    server_name  foo.example01.com;

    proxy_pass <a href="http://10.0.2.2:12000;">http://10.0.2.2:12000;

    #your config;
}

#example02.com
server {
    listen 443 ssl http2;
    server_name  example02.com;

    proxy_pass https://10.0.3.2;

    #your config;
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,277698,277733#msg-277733

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Multiple HTTP2 reverse proxy support ?

sonpg
Edit:
proxy_pass should be put inside a location block.

Example:
location / {
    proxy_pass http://10.0.2.2;
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,277698,277735#msg-277735

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx