Advertisement
Guest User

docker nginx

a guest
Apr 9th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #graduate.conf
  2. server {
  3.     listen 80 default_server;
  4.     listen [::]:80 default_server;
  5.     server_name ${NGINX_HOST};
  6.  
  7.     index index.php index.html;
  8.     error_log  /var/log/nginx/error.log;
  9.     access_log /var/log/nginx/access.log;
  10.     root /var/www/html/public;
  11.  
  12.     location /docs {
  13.       autoindex on;
  14.       autoindex_exact_size off;
  15.     }
  16.  
  17.     location ~ \.php$ {
  18.         try_files $uri =404;
  19.         fastcgi_split_path_info ^(.+\.php)(/.+)$;
  20.         fastcgi_pass php:9000;
  21.         fastcgi_index index.php;
  22.         include fastcgi_params;
  23.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  24.         fastcgi_param PATH_INFO $fastcgi_path_info;
  25.     }
  26. }
  27.  
  28. #docker-compose.yml
  29. version: '3'
  30. services:
  31.     web:
  32.         image: nginx:alpine
  33.         volumes:
  34.             - "./docker/nginx/graduate.conf:/etc/nginx/conf.d/default.template"
  35.             #- "./docker/ssl:/etc/ssl"
  36.             - "./:/var/www/html"
  37.         ports:
  38.             - "8000:80"
  39.             - "3000:443"
  40.         environment:
  41.             - NGINX_HOST=${NGINX_HOST}
  42.         command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
  43.         restart: always
  44.         depends_on:
  45.             - php
  46.             - mysqldb
  47.     php:
  48.         image: nanoninja/php-fpm:${PHP_VERSION}
  49.         restart: always
  50.         volumes:
  51.             - "./docker/php/php.ini:/usr/local/etc/php/conf.d/php.ini"
  52.             - "./:/var/www/html"
  53.         environment:
  54.             - "DB_PORT=3306"
  55.             - "DB_HOST=mysql"
  56.         depends_on:
  57.             - mysqldb
  58.     # php-cli:
  59.     #     image: php-cli:alpine
  60.     #     restart: always
  61.     #     volumes:
  62.     #         - "./:/var/www/html"
  63.     #     env_file:
  64.     #         - ".env"            
  65.     #     environment:
  66.     #         - "DB_PORT=3306"
  67.     #         - "DB_HOST=mysqldb"
  68.     #     tty: true
  69.     mysqldb:
  70.         image: mysql:${MYSQL_VERSION}
  71.         container_name: ${MYSQL_HOST}
  72.         restart: always
  73.         env_file:
  74.             - ".env"
  75.         environment:
  76.             - MYSQL_DATABASE=${MYSQL_DATABASE}
  77.             - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
  78.             - MYSQL_USER=${MYSQL_USER}
  79.             - MYSQL_PASSWORD=${MYSQL_PASSWORD}
  80.         ports:
  81.             - "8989:3306"
  82.         volumes:
  83.             - "./storage/db/mysql:/var/lib/mysql"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement