ユーザ用ツール

サイト用ツール


06_virtualization:05_container:08_docker_compose_nginx

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
06_virtualization:05_container:08_docker_compose_nginx [2021/12/28 15:30] matsui06_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:05_container:02_dcoker_composer|docker-compose]] 
 + 
 +===== Simple Nginx ===== 
 + 
 +<code|docker-compose.yml> 
 +--- 
 +version: '3' 
 +services: 
 +  nginx: 
 +    image: nginx:latest 
 +    ports: 
 +      - "8080:80" 
 +    volumes: 
 +      - ./public:/usr/share/nginx/html 
 +</code> 
 + 
 +===== Nginx + SSL =====
  
 <code|docker-compose.yml> <code|docker-compose.yml>
行 34: 行 50:
  
  
-===== フォルダ用意 =====+==== フォルダ/ファイル用意 ====
 <code> <code>
 mkdir -p nginx/conf.d mkdir -p nginx/conf.d
 mkdir -p nginx/html 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__
 </code> </code>
  
行 53: 行 117:
 </code> </code>
  
-===== 起動 =====+==== 起動 ====
  
   docker-compose up -d   docker-compose up -d
 {{tag>docker-compose docker}} {{tag>docker-compose docker}}
06_virtualization/05_container/08_docker_compose_nginx.1640705434.txt.gz · 最終更新: 2021/12/28 15:30 by matsui