このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
06_virtualization:05_container:08_docker_compose_nginx [2021/12/28 15:30] – matsui | 06_virtualization:05_container:08_docker_compose_nginx [2022/04/08 01:12] (現在) – matsui | ||
---|---|---|---|
行 1: | 行 1: | ||
====== 08 docker-compose Nginx ====== | ====== 08 docker-compose Nginx ====== | ||
- | Nginxを動かすだけのdocker-compose | + | Nginxを動かすだけの[[06_virtualization: |
+ | |||
+ | ===== Simple Nginx ===== | ||
+ | |||
+ | < | ||
+ | --- | ||
+ | version: ' | ||
+ | services: | ||
+ | nginx: | ||
+ | image: nginx: | ||
+ | ports: | ||
+ | - " | ||
+ | volumes: | ||
+ | - ./ | ||
+ | </ | ||
+ | |||
+ | ===== Nginx + SSL ===== | ||
< | < | ||
行 34: | 行 50: | ||
- | ===== フォルダ用意 | + | ==== フォルダ/ |
< | < | ||
mkdir -p nginx/ | mkdir -p nginx/ | ||
mkdir -p nginx/html | mkdir -p nginx/html | ||
+ | hostname > nginx/ | ||
+ | |||
+ | cat << __EOM__ | ||
+ | server { | ||
+ | listen | ||
+ | server_name | ||
+ | |||
+ | #charset koi8-r; | ||
+ | # | ||
+ | |||
+ | location / { | ||
+ | root / | ||
+ | index index.html index.htm; | ||
+ | } | ||
+ | |||
+ | # | ||
+ | |||
+ | # redirect server error pages to the static page /50x.html | ||
+ | # | ||
+ | error_page | ||
+ | location = /50x.html { | ||
+ | root / | ||
+ | } | ||
+ | |||
+ | # proxy the PHP scripts to Apache listening on 127.0.0.1: | ||
+ | # | ||
+ | #location ~ \.php$ { | ||
+ | # proxy_pass | ||
+ | #} | ||
+ | |||
+ | # pass the PHP scripts to FastCGI server listening on 127.0.0.1: | ||
+ | # | ||
+ | #location ~ \.php$ { | ||
+ | # root html; | ||
+ | # fastcgi_pass | ||
+ | # fastcgi_index | ||
+ | # fastcgi_param | ||
+ | # include | ||
+ | #} | ||
+ | |||
+ | # deny access to .htaccess files, if Apache' | ||
+ | # concurs with nginx' | ||
+ | # | ||
+ | #location ~ /\.ht { | ||
+ | # deny all; | ||
+ | #} | ||
+ | } | ||
+ | __EOM__ | ||
</ | </ | ||
行 53: | 行 117: | ||
</ | </ | ||
- | ===== 起動 | + | ==== 起動 ==== |
docker-compose up -d | docker-compose up -d | ||
{{tag> | {{tag> |