mirror of
https://github.com/nginx-proxy/nginx-proxy
synced 2024-05-31 20:06:21 +02:00
bd1aeda540
Syntax: VIRTUAL_PORT = [ <virtual_port> | <multiport> ]; multiport = port, { ",", port }; port = <virtual_port> [ ":", <virtual_path> [ ":", <virtual_dest> ]]; Example with multiport syntax: VIRTUAL_HOST: "multiport.example.com" VIRTUAL_PORT: "9220:~ ^/(admin|fonts?|images|webmin)/,10901,20901:/ws2p,30901:/gva/playground" Produces: # multiport.example.com:10901 upstream multiport.example.com-10901 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 10901 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:10901; } # multiport.example.com:20901/ws2p upstream multiport.example.com-5c7ebef820fe004e45e3af1d0c47971594d028b2-20901 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 20901 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:20901; } # multiport.example.com:30901/gva/playground upstream multiport.example.com-1f02ce2421b17d828edaabfc3014360891bb0be3-30901 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 30901 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:30901; } # multiport.example.com:9220~ ^/(admin|fonts?|images|webmin)/ upstream multiport.example.com-cae8bfc2ea1fe6bb6fda08727ab065e8fed98aa2-9220 { # Exposed ports: [{ 10901 tcp } { 20901 tcp } { 30901 tcp } { 9220 tcp }] # Default virtual port: 80 # VIRTUAL_PORT: 9220 ## Can be connected with "docker-gen-bridge" network # blah server 172.29.0.5:9220; } server { server_name multiport.example.com; access_log /var/log/nginx/access.log vhost; listen 80 ; location / { proxy_pass http://multiport.example.com-10901; } location /ws2p { proxy_pass http://multiport.example.com-5c7ebef820fe004e45e3af1d0c47971594d028b2-20901/; } location /gva/playground { proxy_pass http://multiport.example.com-1f02ce2421b17d828edaabfc3014360891bb0be3-30901; } location ~ ^/(admin|fonts?|images|webmin)/ { proxy_pass http://multiport.example.com-cae8bfc2ea1fe6bb6fda08727ab065e8fed98aa2-9220; } } This feature is discussed in that upstream issue: https://github.com/nginx-proxy/nginx-proxy/issues/1504
32 lines
772 B
YAML
32 lines
772 B
YAML
version: "2"
|
|
|
|
services:
|
|
web:
|
|
image: web
|
|
expose:
|
|
- "83"
|
|
environment:
|
|
WEB_PORTS: "83"
|
|
VIRTUAL_HOST: "web.nginx-proxy.tld,web1.nginx-proxy.tld"
|
|
VIRTUAL_PORT: "83"
|
|
VIRTUAL_PATH: "/which-port"
|
|
VIRTUAL_DEST: "/port"
|
|
|
|
web1:
|
|
image: web
|
|
expose:
|
|
- "80"
|
|
- "81"
|
|
environment:
|
|
WEB_PORTS: "80 81"
|
|
VIRTUAL_HOST: "web1.nginx-proxy.tld"
|
|
VIRTUAL_PORT: "80:/80:/,81:/81:/"
|
|
|
|
sut:
|
|
image: nginxproxy/nginx-proxy:test
|
|
volumes:
|
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
|
- ./web.nginx-proxy.tld_022792f37cc2c58102bdf79316aebed215e0de21_location:/etc/nginx/vhost.d/web.nginx-proxy.tld_022792f37cc2c58102bdf79316aebed215e0de21_location
|
|
environment:
|
|
DEFAULT_ROOT: "405"
|