vpsサーバ(centos7)にdocker-composeを使ってnginx(1.13.10),mysql(5.7)の環境を作りlaravelを動かしているのですが、
プロジェクトを増やさなければならなくなり、新しいプロジェクトファイル設置後にnginxの設定ファイルを色々変更してみてはいるのですが「ERR_CONNECTION_REFUSED」になり、上手く表示する事が出来ません。
※既存のプロジェクトファイルは問題なく動いています。
DockerFileやDockercomposeの設定ファイルも変更する必要があるのでしょうか?
ご教示お願いします。
nginx/default.conf
nginx
1server { 2 3 listen 80; 4 server_name 133.242.162.205; 5 root /var/www/project01/public; 6 index index.php index.html index.htm; 7 8 location / { 9 try_files $uri $uri/ /index.php$is_args$args; 10 } 11 12 location ~ .php$ { 13 try_files $uri /index.php =404; 14 fastcgi_pass php-upstream; 15 fastcgi_index index.php; 16 fastcgi_buffers 16 16k; 17 fastcgi_buffer_size 32k; 18 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 19 #fixes timeouts 20 fastcgi_read_timeout 600; 21 include fastcgi_params; 22 } 23 24 location ~ /.ht { 25 deny all; 26 } 27 28 location /.well-known/acme-challenge/ { 29 root /var/www/letsencrypt/; 30 log_not_found off; 31 } 32} 33 34server { 35 36 listen 8080; 37 server_name 133.242.162.205; 38 root /var/www/project02/public; 39 index index.php index.html index.htm; 40 41 location / { 42 try_files $uri $uri/ /index.php$is_args$args; 43 } 44 45 location ~ .php$ { 46 try_files $uri /index.php =404; 47 fastcgi_pass php-upstream; 48 fastcgi_index index.php; 49 fastcgi_buffers 16 16k; 50 fastcgi_buffer_size 32k; 51 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 52 #fixes timeouts 53 fastcgi_read_timeout 600; 54 include fastcgi_params; 55 } 56 57 location ~ /.ht { 58 deny all; 59 } 60 61 location /.well-known/acme-challenge/ { 62 root /var/www/letsencrypt/; 63 log_not_found off; 64 } 65}
docker-compose.yml
nginx: build: context: ./nginx args: - PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER} - PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT} volumes_from: - applications volumes: - ${NGINX_HOST_LOG_PATH}:/var/log/nginx - ${NGINX_SITES_PATH}:/etc/nginx/sites-available ports: - "${NGINX_HOST_HTTP_PORT}:80" - "${NGINX_HOST_HTTPS_PORT}:443" depends_on: - php-fpm networks: - frontend - backend
Dockerfile
FROM nginx:alpine MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> ADD nginx.conf /etc/nginx/ # If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env. ARG CHANGE_SOURCE=false RUN if [ ${CHANGE_SOURCE} = true ]; then \ # Change application source from dl-cdn.alpinelinux.org to aliyun source sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \ ;fi RUN apk update \ && apk upgrade \ && apk add --no-cache bash \ && adduser -D -H -u 1000 -s /bin/bash www-data ARG PHP_UPSTREAM_CONTAINER=php-fpm ARG PHP_UPSTREAM_PORT=9000 # Set upstream conf and remove the default conf RUN echo "upstream php-upstream { server ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" > /etc/nginx/conf.d/upstream.conf \ && rm /etc/nginx/conf.d/default.conf CMD ["nginx"] EXPOSE 80 443