ユーザ用ツール

サイト用ツール


サイドバー

このページの翻訳:



最近の更新



Tag Cloud

06_virtualization:05_container:09_reverse_proxy

文書の過去の版を表示しています。


09 リバースプロキシ

この設定で下記のように表示されます。
hogehoge.com → reverse.com
hogehoge2.com → reverse2.com
hogehoge3.com → reverse3.com

docker-compose.yml

docker-compose.yml

version: '3.3'

services:
  nginx-proxy:
    image: jwilder/nginx-proxy
    labels:
      - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true
    ports:
# nesessary port 80 for Let's Encrypt
      - 80:80
      - 443:443
    volumes:
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ./certs:/etc/nginx/certs:ro
      - ./nginx-proxy/custom.conf:/etc/nginx/conf.d/custom.conf:ro
    restart: always

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    volumes:
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./certs:/etc/nginx/certs:rw
    restart: always

  bridge-1:
    image: nginx:latest
    volumes:
      - ./bridge-1/default.conf:/etc/nginx/conf.d/default.conf
      - ./bridge-1:/var/www/html
    environment:
      - VIRTUAL_PORT=80
      - VIRTUAL_HOST=hogehoge.com, hogehoge2.com, hogehoge3.com
      - LETSENCRYPT_HOST=hogehoge.com, hogehoge2.com, hogehoge3.com
      - LETSENCRYPT_EMAIL=info@kumolabo.com
    restart: always

volumes:
  vhost:
  html:

./bridge-1/default.conf

./bridge-1/default.conf
server {

  listen 80;
  server_name hogehoge.com;
  location / {
proxy_request_buffering off;
      proxy_pass http://reverse.com/;
      proxy_redirect off;
      proxy_set_header Host            $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

}
server {

  listen 80;
  server_name hogehoge2.com;
  location / {
proxy_request_buffering off;
      proxy_pass http://reverse2.com/;
      proxy_redirect off;
      proxy_set_header Host            $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

}
server {

  listen 80;
  server_name hogehoge3.com;
  location / {
proxy_request_buffering off;
      proxy_pass http://reverse3.com/;
      proxy_redirect off;
      proxy_set_header Host            $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

}
</code>

06_virtualization/05_container/09_reverse_proxy.1644294816.txt.gz · 最終更新: 2022/02/08 13:33 by matsui