Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ docker logs --details mymagento2docker_nginx_1
- 2016/10/04 19:18:31 [crit] 7#7: *2 connect() to unix:/var/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 172.17.0.1, server: magento2.docker, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "magento2.docker"
- 172.17.0.1 - - [04/Oct/2016:19:18:31 +0000] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36" "-"
- $ docker-compose ps
- Name Command State Ports
- --------------------------------------------------------------------------------------------------
- mymagento2docker_app_1 true Exit 0
- mymagento2docker_data_1 docker-entrypoint.sh true Exit 0
- mymagento2docker_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
- mymagento2docker_nginx_1 nginx -g daemon off; Up 443/tcp, 0.0.0.0:80->80/tcp
- mymagento2docker_php_1 php-fpm Up 9000/tcp
- mymagento2docker_phpmyadmin_1 /run.sh phpmyadmin Up 0.0.0.0:8080->80/tcp
- $ docker exec -it mymagento2docker_php_1 /bin/bash
- root@e220b07a7124:/var/www/html# php -v
- PHP 7.0.11 (cli) (built: Sep 23 2016 21:47:48) ( NTS )
- Copyright (c) 1997-2016 The PHP Group
- Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
- root@e220b07a7124:/var/www/html# ls /var/run/php
- ls: cannot access /var/run/php: No such file or directory
- root@e220b07a7124:/var/www/html# ls /var/run/
- exim4 lock utmp
- root@e220b07a7124:/var/www/html# find / -name "*sock"
- /sys/devices/virtual/misc/vsock
- /sys/class/misc/vsock
- /sys/module/vsock
- /sys/module/hv_sock
- root@e220b07a7124:/var/www/html# find / -type d -path /var/www/html -prune -o -name "php"
- /usr/local/lib/php
- /usr/local/etc/php
- /usr/local/include/php
- /usr/local/bin/php
- /usr/local/php
- /usr/local/php/php
- /var/www/html
- ├── docker-compose.yml
- ├── magento2
- │ ├── [Lots ommited...]
- │ ├── [Lots ommited...]
- ├── nginx
- │ ├── Dockerfile
- │ ├── default.conf
- │ └── nginx.conf
- └── php
- └── Dockerfile
- # http://tech.osteel.me/posts/2015/12/18/from-vagrant-to-docker-how-to-use-docker-for-local-web-development.html#installation
- # composer create-project --ignore-platform-reqs --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
- nginx:
- build: ./nginx/
- ports:
- - 80:80
- links:
- - php
- volumes_from:
- - app
- php:
- build: ./php/
- expose:
- - 9000
- links:
- - mysql
- volumes_from:
- - app
- app:
- image: php:7.0-fpm
- volumes:
- - ./magento2:/var/www/html
- command: "true"
- mysql:
- image: mysql:latest
- volumes_from:
- - data
- ports:
- - "3306:3306"
- environment:
- MYSQL_ROOT_PASSWORD: mage2
- MYSQL_DATABASE: mage2
- MYSQL_USER: mage2
- MYSQL_PASSWORD: mage2
- data:
- image: mysql:latest
- volumes:
- - /var/lib/mysql
- command: "true"
- phpmyadmin:
- image: phpmyadmin/phpmyadmin
- ports:
- - 8080:80
- links:
- - mysql
- environment:
- PMA_HOST: mysql
- FROM php:7.0-fpm
- # Install dependencies
- RUN apt-get update
- && apt-get install -y
- cron
- libfreetype6-dev
- libicu-dev
- libjpeg62-turbo-dev
- libmcrypt-dev
- libpng12-dev
- libxslt1-dev
- # Configure the gd library
- RUN docker-php-ext-configure
- gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
- # Install required PHP extensions
- RUN docker-php-ext-install
- gd
- intl
- mbstring
- mcrypt
- pdo_mysql
- xsl
- zip
- soap
- # Install the 2.4 version of xdebug that's compatible with php7
- RUN pecl install -o -f xdebug-2.4.0
- FROM nginx:latest
- RUN rm -f /etc/nginx/conf.d/*
- RUN rm -f /etc/nginx/nginx.conf
- COPY ./nginx.conf /etc/nginx/
- COPY ./default.conf /etc/nginx/conf.d/default.conf
- # Example configuration:
- upstream fastcgi_backend {
- # use tcp connection
- server unix:/var/run/php/php7.0-fpm.sock;
- # I"ve also tried the below...
- # server 127.0.0.1:9000;
- # server fpm:9000;
- }
- server {
- listen 80;
- server_name magento2.docker;
- set $MAGE_ROOT /var/www/html/;
- set $MAGE_MODE default;
- root $MAGE_ROOT/pub;
- index index.php;
- autoindex off;
- charset off;
- add_header 'X-Content-Type-Options' 'nosniff';
- add_header 'X-XSS-Protection' '1; mode=block';
- location /setup {
- root $MAGE_ROOT;
- location ~ ^/setup/index.php {
- fastcgi_pass fastcgi_backend;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- location ~ ^/setup/(?!pub/). {
- deny all;
- }
- location ~ ^/setup/pub/ {
- add_header X-Frame-Options "SAMEORIGIN";
- }
- }
- location /update {
- root $MAGE_ROOT;
- location ~ ^/update/index.php {
- fastcgi_split_path_info ^(/update/index.php)(/.+)$;
- fastcgi_pass fastcgi_backend;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- fastcgi_param PATH_INFO $fastcgi_path_info;
- include fastcgi_params;
- }
- # deny everything but index.php
- location ~ ^/update/(?!pub/). {
- deny all;
- }
- location ~ ^/update/pub/ {
- add_header X-Frame-Options "SAMEORIGIN";
- }
- }
- location / {
- try_files $uri $uri/ /index.php?$args;
- }
- location /pub {
- location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*.xml) {
- deny all;
- }
- alias $MAGE_ROOT/pub;
- add_header X-Frame-Options "SAMEORIGIN";
- }
- location /static/ {
- if ($MAGE_MODE = "production") {
- expires max;
- }
- location ~ ^/static/version {
- rewrite ^/static/(versiond*/)?(.*)$ /static/$2 last;
- }
- location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
- add_header Cache-Control "public";
- add_header X-Frame-Options "SAMEORIGIN";
- expires +1y;
- if (!-f $request_filename) {
- rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
- }
- }
- location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
- add_header Cache-Control "no-store";
- add_header X-Frame-Options "SAMEORIGIN";
- expires off;
- if (!-f $request_filename) {
- rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
- }
- }
- if (!-f $request_filename) {
- rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
- }
- add_header X-Frame-Options "SAMEORIGIN";
- }
- location /media/ {
- try_files $uri $uri/ /get.php?$args;
- location ~ ^/media/theme_customization/.*.xml {
- deny all;
- }
- location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
- add_header Cache-Control "public";
- add_header X-Frame-Options "SAMEORIGIN";
- expires +1y;
- try_files $uri $uri/ /get.php?$args;
- }
- location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
- add_header Cache-Control "no-store";
- add_header X-Frame-Options "SAMEORIGIN";
- expires off;
- try_files $uri $uri/ /get.php?$args;
- }
- add_header X-Frame-Options "SAMEORIGIN";
- }
- location /media/customer/ {
- deny all;
- }
- location /media/downloadable/ {
- deny all;
- }
- location /media/import/ {
- deny all;
- }
- location ~ cron.php {
- deny all;
- }
- location ~ (index|get|static|report|404|503).php$ {
- try_files $uri =404;
- fastcgi_pass fastcgi_backend;
- fastcgi_param PHP_FLAG "session.auto_start=off n suhosin.session.cryptua=off";
- fastcgi_param PHP_VALUE "memory_limit=512M n max_execution_time=600";
- fastcgi_read_timeout 600s;
- fastcgi_connect_timeout 600s;
- fastcgi_param MAGE_MODE $MAGE_MODE;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- }
- error_log /var/log/nginx/error.log warn;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- '$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- access_log /var/log/nginx/access.log main;
- sendfile on;
- tcp_nopush on;
- keepalive_timeout 65;
- fastcgi_buffers 8 16k;
- fastcgi_buffer_size 32k;
- fastcgi_connect_timeout 300;
- fastcgi_send_timeout 300;
- fastcgi_read_timeout 300;
- gzip on;
- include /etc/nginx/conf.d/*;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement