ユーザ用ツール

サイト用ツール


サイドバー



最近の更新



Tag Cloud

タグ数量
9
10
1
3
1
2
17
7
1
1
4
13
4
1
2
309
1
9
2
7
21
5
1
31
3
3
1
6
1
1
46
1
3
3
1
1
1
1
1
1
33
46
7
9
10
8
10
3
21
2
9
2
2
6
9
1
1
6
12
4
3
3
2
1
8
2
4
1
6
30
2
12
5
3
1
1
2
3
2
1
3
4
3
3
4
2
2
1
1
2
1
2
1
2
1
27
2
1
3
2
2
1
1
2
3
17
5
9
1
1
2
16
2
6
1
2
12
1
3
1
1
4
11
1
6
4
2
7
1
3
3
13
1
4
1
1
10
3
1
17
3
1
5
1
2
1
1
2
9
2
2
3
2
1
3
1
3
1
2
2
2
1
2
6
1
4
3
5
1
3
1
3
3
2
1
1
30
1
3
3
1
1
1
5
5
1
36
2
4
2
1
2
2
3
1
1
1
4
1
2
1
3
1
1
1
2
5
2
5
2
1
1
1
5
3
2
4
4
1
2
2
25
1
1
3
4
1
1
2
1
1
2
1
1
1
1
2
1
1
1
1
1
19
7
1
5
1
1
3
1
2
1
1
2
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
4
2
1
1
2
2
2
1
1
2
1
1
12
1
1
1
1
1
1
1
1
1
1
1
1
1
06_virtualization:05_container:08_docker_compose_nginx

08 docker-compose Nginx

Nginxを動かすだけのdocker-compose

Simple Nginx

docker-compose.yml

---
version: '3'
services:
  nginx:
    image: nginx:latest
    ports:
      - "8080:80"
    volumes:
      - ./public:/usr/share/nginx/html

Nginx + SSL

docker-compose.yml

---
version: "2.1"
services:
  https-portal:
    image: steveltn/https-portal:1
    ports:
      - '80:80'
      - '443:443'
    links:
      - web
    #restart: always
    restart: unless-stopped
    environment:
      DOMAINS: 'testwiki.hogehoge.com -> http://web'
      STAGE: 'local'
      #STAGE: 'production'
      #FORCE_RENEW: 'true'
    volumes:
      - ./docker/web/:/etc/nginx/conf.d/
      
  web:
    image: nginx:1.15.6
    #ports:
    #- '8000:80'
    volumes:
     - ./nginx/conf.d:/etc/nginx/conf.d
     - ./nginx/html:/var/www/html

フォルダ/ファイル用意

mkdir -p nginx/conf.d
mkdir -p nginx/html
hostname > nginx/html/index.html

cat << __EOM__ 
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /var/www/html;
        index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /var/www/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}
__EOM__
# tree -l /app
/app
├── docker
│   └── web
├── docker-compose.yml
└── nginx
    ├── conf.d
    │   └── default.conf
    └── html
        └── index.html

起動

docker-compose up -d
06_virtualization/05_container/08_docker_compose_nginx.txt · 最終更新: 2022/04/08 10:12 by matsui

Yesterday:860 Today:874 Total:237487