Advertisement
Guest User

Untitled

a guest
Oct 4th, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.26 KB | None | 0 0
  1. $ docker logs --details mymagento2docker_nginx_1
  2. 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"
  3. 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" "-"
  4.  
  5. $ docker-compose ps
  6. Name Command State Ports
  7. --------------------------------------------------------------------------------------------------
  8. mymagento2docker_app_1 true Exit 0
  9. mymagento2docker_data_1 docker-entrypoint.sh true Exit 0
  10. mymagento2docker_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
  11. mymagento2docker_nginx_1 nginx -g daemon off; Up 443/tcp, 0.0.0.0:80->80/tcp
  12. mymagento2docker_php_1 php-fpm Up 9000/tcp
  13. mymagento2docker_phpmyadmin_1 /run.sh phpmyadmin Up 0.0.0.0:8080->80/tcp
  14.  
  15. $ docker exec -it mymagento2docker_php_1 /bin/bash
  16. root@e220b07a7124:/var/www/html# php -v
  17. PHP 7.0.11 (cli) (built: Sep 23 2016 21:47:48) ( NTS )
  18. Copyright (c) 1997-2016 The PHP Group
  19. Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
  20.  
  21. root@e220b07a7124:/var/www/html# ls /var/run/php
  22. ls: cannot access /var/run/php: No such file or directory
  23.  
  24. root@e220b07a7124:/var/www/html# ls /var/run/
  25. exim4 lock utmp
  26.  
  27. root@e220b07a7124:/var/www/html# find / -name "*sock"
  28. /sys/devices/virtual/misc/vsock
  29. /sys/class/misc/vsock
  30. /sys/module/vsock
  31. /sys/module/hv_sock
  32.  
  33. root@e220b07a7124:/var/www/html# find / -type d -path /var/www/html -prune -o -name "php"
  34. /usr/local/lib/php
  35. /usr/local/etc/php
  36. /usr/local/include/php
  37. /usr/local/bin/php
  38. /usr/local/php
  39. /usr/local/php/php
  40. /var/www/html
  41.  
  42. ├── docker-compose.yml
  43. ├── magento2
  44. │   ├── [Lots ommited...]
  45. │   ├── [Lots ommited...]
  46. ├── nginx
  47. │   ├── Dockerfile
  48. │   ├── default.conf
  49. │   └── nginx.conf
  50. └── php
  51. └── Dockerfile
  52.  
  53. # http://tech.osteel.me/posts/2015/12/18/from-vagrant-to-docker-how-to-use-docker-for-local-web-development.html#installation
  54. # composer create-project --ignore-platform-reqs --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
  55.  
  56. nginx:
  57. build: ./nginx/
  58. ports:
  59. - 80:80
  60. links:
  61. - php
  62. volumes_from:
  63. - app
  64.  
  65. php:
  66. build: ./php/
  67. expose:
  68. - 9000
  69. links:
  70. - mysql
  71. volumes_from:
  72. - app
  73.  
  74. app:
  75. image: php:7.0-fpm
  76. volumes:
  77. - ./magento2:/var/www/html
  78. command: "true"
  79.  
  80. mysql:
  81. image: mysql:latest
  82. volumes_from:
  83. - data
  84. ports:
  85. - "3306:3306"
  86. environment:
  87. MYSQL_ROOT_PASSWORD: mage2
  88. MYSQL_DATABASE: mage2
  89. MYSQL_USER: mage2
  90. MYSQL_PASSWORD: mage2
  91.  
  92. data:
  93. image: mysql:latest
  94. volumes:
  95. - /var/lib/mysql
  96. command: "true"
  97.  
  98. phpmyadmin:
  99. image: phpmyadmin/phpmyadmin
  100. ports:
  101. - 8080:80
  102. links:
  103. - mysql
  104. environment:
  105. PMA_HOST: mysql
  106.  
  107. FROM php:7.0-fpm
  108.  
  109. # Install dependencies
  110. RUN apt-get update
  111. && apt-get install -y
  112. cron
  113. libfreetype6-dev
  114. libicu-dev
  115. libjpeg62-turbo-dev
  116. libmcrypt-dev
  117. libpng12-dev
  118. libxslt1-dev
  119.  
  120. # Configure the gd library
  121. RUN docker-php-ext-configure
  122. gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
  123.  
  124. # Install required PHP extensions
  125. RUN docker-php-ext-install
  126. gd
  127. intl
  128. mbstring
  129. mcrypt
  130. pdo_mysql
  131. xsl
  132. zip
  133. soap
  134.  
  135. # Install the 2.4 version of xdebug that's compatible with php7
  136. RUN pecl install -o -f xdebug-2.4.0
  137.  
  138. FROM nginx:latest
  139.  
  140. RUN rm -f /etc/nginx/conf.d/*
  141. RUN rm -f /etc/nginx/nginx.conf
  142. COPY ./nginx.conf /etc/nginx/
  143. COPY ./default.conf /etc/nginx/conf.d/default.conf
  144.  
  145. # Example configuration:
  146. upstream fastcgi_backend {
  147. # use tcp connection
  148. server unix:/var/run/php/php7.0-fpm.sock;
  149. # I"ve also tried the below...
  150. # server 127.0.0.1:9000;
  151. # server fpm:9000;
  152. }
  153.  
  154. server {
  155. listen 80;
  156.  
  157. server_name magento2.docker;
  158. set $MAGE_ROOT /var/www/html/;
  159. set $MAGE_MODE default;
  160.  
  161. root $MAGE_ROOT/pub;
  162.  
  163. index index.php;
  164. autoindex off;
  165. charset off;
  166.  
  167. add_header 'X-Content-Type-Options' 'nosniff';
  168. add_header 'X-XSS-Protection' '1; mode=block';
  169.  
  170. location /setup {
  171. root $MAGE_ROOT;
  172. location ~ ^/setup/index.php {
  173. fastcgi_pass fastcgi_backend;
  174. fastcgi_index index.php;
  175. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  176. include fastcgi_params;
  177. }
  178.  
  179. location ~ ^/setup/(?!pub/). {
  180. deny all;
  181. }
  182.  
  183. location ~ ^/setup/pub/ {
  184. add_header X-Frame-Options "SAMEORIGIN";
  185. }
  186. }
  187.  
  188. location /update {
  189. root $MAGE_ROOT;
  190.  
  191. location ~ ^/update/index.php {
  192. fastcgi_split_path_info ^(/update/index.php)(/.+)$;
  193. fastcgi_pass fastcgi_backend;
  194. fastcgi_index index.php;
  195. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  196. fastcgi_param PATH_INFO $fastcgi_path_info;
  197. include fastcgi_params;
  198. }
  199.  
  200. # deny everything but index.php
  201. location ~ ^/update/(?!pub/). {
  202. deny all;
  203. }
  204.  
  205. location ~ ^/update/pub/ {
  206. add_header X-Frame-Options "SAMEORIGIN";
  207. }
  208. }
  209.  
  210. location / {
  211. try_files $uri $uri/ /index.php?$args;
  212. }
  213.  
  214. location /pub {
  215. location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*.xml) {
  216. deny all;
  217. }
  218. alias $MAGE_ROOT/pub;
  219. add_header X-Frame-Options "SAMEORIGIN";
  220. }
  221.  
  222. location /static/ {
  223. if ($MAGE_MODE = "production") {
  224. expires max;
  225. }
  226. location ~ ^/static/version {
  227. rewrite ^/static/(versiond*/)?(.*)$ /static/$2 last;
  228. }
  229.  
  230. location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  231. add_header Cache-Control "public";
  232. add_header X-Frame-Options "SAMEORIGIN";
  233. expires +1y;
  234.  
  235. if (!-f $request_filename) {
  236. rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
  237. }
  238. }
  239. location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
  240. add_header Cache-Control "no-store";
  241. add_header X-Frame-Options "SAMEORIGIN";
  242. expires off;
  243.  
  244. if (!-f $request_filename) {
  245. rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
  246. }
  247. }
  248. if (!-f $request_filename) {
  249. rewrite ^/static/(versiond*/)?(.*)$ /static.php?resource=$2 last;
  250. }
  251. add_header X-Frame-Options "SAMEORIGIN";
  252. }
  253.  
  254. location /media/ {
  255. try_files $uri $uri/ /get.php?$args;
  256.  
  257. location ~ ^/media/theme_customization/.*.xml {
  258. deny all;
  259. }
  260.  
  261. location ~* .(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
  262. add_header Cache-Control "public";
  263. add_header X-Frame-Options "SAMEORIGIN";
  264. expires +1y;
  265. try_files $uri $uri/ /get.php?$args;
  266. }
  267. location ~* .(zip|gz|gzip|bz2|csv|xml)$ {
  268. add_header Cache-Control "no-store";
  269. add_header X-Frame-Options "SAMEORIGIN";
  270. expires off;
  271. try_files $uri $uri/ /get.php?$args;
  272. }
  273. add_header X-Frame-Options "SAMEORIGIN";
  274. }
  275.  
  276. location /media/customer/ {
  277. deny all;
  278. }
  279.  
  280. location /media/downloadable/ {
  281. deny all;
  282. }
  283.  
  284. location /media/import/ {
  285. deny all;
  286. }
  287.  
  288. location ~ cron.php {
  289. deny all;
  290. }
  291.  
  292. location ~ (index|get|static|report|404|503).php$ {
  293. try_files $uri =404;
  294. fastcgi_pass fastcgi_backend;
  295.  
  296. fastcgi_param PHP_FLAG "session.auto_start=off n suhosin.session.cryptua=off";
  297. fastcgi_param PHP_VALUE "memory_limit=512M n max_execution_time=600";
  298. fastcgi_read_timeout 600s;
  299. fastcgi_connect_timeout 600s;
  300. fastcgi_param MAGE_MODE $MAGE_MODE;
  301.  
  302. fastcgi_index index.php;
  303. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  304. include fastcgi_params;
  305. }
  306. }
  307.  
  308. error_log /var/log/nginx/error.log warn;
  309. pid /var/run/nginx.pid;
  310.  
  311. events {
  312. worker_connections 1024;
  313. }
  314.  
  315. http {
  316. include /etc/nginx/mime.types;
  317. default_type application/octet-stream;
  318.  
  319. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  320. '$status $body_bytes_sent "$http_referer" '
  321. '"$http_user_agent" "$http_x_forwarded_for"';
  322.  
  323. access_log /var/log/nginx/access.log main;
  324.  
  325. sendfile on;
  326. tcp_nopush on;
  327.  
  328. keepalive_timeout 65;
  329.  
  330. fastcgi_buffers 8 16k;
  331. fastcgi_buffer_size 32k;
  332. fastcgi_connect_timeout 300;
  333. fastcgi_send_timeout 300;
  334. fastcgi_read_timeout 300;
  335.  
  336. gzip on;
  337.  
  338. include /etc/nginx/conf.d/*;
  339. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement