Browse Source

php 5.6-fpm is working

Bachir Soussi Chiadmi 6 years ago
parent
commit
66457e6eb2
4 changed files with 27 additions and 11 deletions
  1. 1 0
      base_d7/index.php
  2. 13 1
      docker-compose.yml
  3. 10 10
      nginx/default.conf
  4. 3 0
      php/Dockerfile

+ 1 - 0
base_d7/index.html → base_d7/index.php

@@ -6,5 +6,6 @@
   </head>
   <body>
     <h1>Hello world!</h1>
+    <?php phpinfo(); ?>
   </body>
 </html>

+ 13 - 1
docker-compose.yml

@@ -10,8 +10,20 @@ services:
             - "${LOG_ROOT}:/var/log:rw"
         networks:
             - server
+        depends_on:
+            - php
+
+    php:
+        build: ./php/
+        expose:
+            - 9000
+        volumes:
+            - "${PROJECT_ROOT}:/var/www/html"
+        networks:
+            # - database
+            - server
         # depends_on:
-        #     - php
+        #     - mysql
 
 networks:
     server:

+ 10 - 10
nginx/default.conf

@@ -19,16 +19,16 @@ server {
 
     client_max_body_size 100m;
 
-    # location ~ \.php$ {
-    #     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_intercept_errors off;
-    #     fastcgi_buffer_size 16k;
-    #     fastcgi_buffers 4 16k;
-    # }
+    location ~ \.php$ {
+        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_intercept_errors off;
+        fastcgi_buffer_size 16k;
+        fastcgi_buffers 4 16k;
+    }
 
     location ~ /\.ht {
         deny all;

+ 3 - 0
php/Dockerfile

@@ -0,0 +1,3 @@
+FROM php:5.6-fpm
+
+# RUN docker-php-ext-install pdo_mysql