From a16174768f933057aa328702011fd848134d9c5e Mon Sep 17 00:00:00 2001
From: Benjamin GUILLON <benjamin.guillon@cc.in2p3.fr>
Date: Fri, 3 Apr 2020 21:44:07 +0200
Subject: [PATCH] Update docker/php-fpm/Dockerfile, tms/symfony.conf,
 docker/nginx/Dockerfile files

---
 docker/nginx/Dockerfile   |  3 ++-
 docker/php-fpm/Dockerfile |  4 ++--
 tms/symfony.conf          | 33 +++++++++++++++++++--------------
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/docker/nginx/Dockerfile b/docker/nginx/Dockerfile
index b842f5d7..19519f8b 100644
--- a/docker/nginx/Dockerfile
+++ b/docker/nginx/Dockerfile
@@ -1,5 +1,6 @@
 FROM gitlab-registry.in2p3.fr/cc-in2p3-devops/openshift-origin/openshift-images/nginx:stable-alpine
 LABEL maintainer="CNRS/CCIN2P3 DevOps Team"
 
-ADD php-build/symfony.conf /etc/nginx/conf.d/default.conf
+ADD php-build/symfony.conf /etc/nginx/conf.d/tms.conf
+RUN rm /etc/nginx/conf.d/default.conf
 ADD php-build/public /var/www/tms/public
diff --git a/docker/php-fpm/Dockerfile b/docker/php-fpm/Dockerfile
index 759817bc..8082de03 100644
--- a/docker/php-fpm/Dockerfile
+++ b/docker/php-fpm/Dockerfile
@@ -5,5 +5,5 @@ RUN apk add --no-cache --virtual .php-build zlib-dev libpng-dev libjpeg-turbo-de
     && docker-php-ext-configure gd --with-freetype --with-jpeg \
     && docker-php-ext-install -j$(nproc) gd mysqli pdo pdo_mysql
 
-WORKDIR /var/www/html
-ADD php-build /var/www/html
+WORKDIR /var/www/tms
+ADD php-build /var/www/tms
diff --git a/tms/symfony.conf b/tms/symfony.conf
index ba5b9170..7cd6e72f 100644
--- a/tms/symfony.conf
+++ b/tms/symfony.conf
@@ -1,22 +1,27 @@
 server {
     listen 8081;
-    server_name  localhost;
-    index index.php index.html;
-    root /usr/share/nginx/html/tms;
+    root /var/www/tms/public;
+    index index.html index.htm index.php;
+    server_name  _;
+    charset utf-8;
+    location = /favicon.ico { log_not_found off; access_log off; }
+    location = /robots.txt  { log_not_found off; access_log off; }
 
-    # redirect server error pages to the static page /50x.html
-    error_page   500 502 503 504  /50x.html;
-    location = /50x.html {
-        root   /usr/share/nginx/html;
+    location / {
+        try_files $uri $uri/ /index.php$is_args$args;
     }
 
-    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
-    #
-    location ~ /.*\.php$ {
-        fastcgi_pass   php-tms:9000;
-        fastcgi_index  index.php;
-        include fastcgi.conf; 
-        include        fastcgi_params;
+    location ~ \.php$ {
+        fastcgi_split_path_info ^(.+\.php)(/.+)$;
+        fastcgi_pass php-tms:9000;
+        fastcgi_index index.php;
+        include fastcgi_params;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     }
+
+    error_page 404 /index.php;
+
+    location ~ /\.ht {
+        deny all;
+    }
 }
-- 
GitLab