~/h.gimslab.com $ cat docker-compose.yml version: '2' services: nginx: image: nginx:latest ports: - "80:80" volumes: - ./nginx/code:/code - ./nginx/site.conf:/etc/nginx/conf.d/site.conf depends_on: - php php: image: php:7-fpm volumes: - ./nginx/code:/code
~/h.gimslab.com $ ll nginx/ -R nginx/: total 8 drwxr-xr-x 2 xxx xxx 4096 Jul 23 00:37 code -rw-r--r-- 1 xxx xxx 488 Jul 23 00:38 site.conf nginx/code: total 12 -rw-r--r-- 1 xxx xxx 13 Jul 23 00:35 index.html -rw-r--r-- 1 xxx xxx 22 Jul 23 00:06 index.php -rw-r--r-- 1 xxx xxx 4 Jul 23 00:37 z.html
~/h.gimslab.com $ cat nginx/site.conf server { index index.html; server_name gimspi; root /code; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass php:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } }