From 56916a79702a63ae7c77f002080dc4155457c3d6 Mon Sep 17 00:00:00 2001 From: Florian THIERRY Date: Sun, 22 May 2022 12:51:19 +0200 Subject: [PATCH] Initial commit. --- docker-compose.yml | 23 +++++++++++++++++++++++ fastcgi.conf | 18 ++++++++++++++++++ nginx.conf | 41 +++++++++++++++++++++++++++++++++++++++++ www/app.html | 9 +++++++++ www/app.php | 12 ++++++++++++ www/test.html | 9 +++++++++ 6 files changed, 112 insertions(+) create mode 100644 docker-compose.yml create mode 100644 fastcgi.conf create mode 100644 nginx.conf create mode 100644 www/app.html create mode 100644 www/app.php create mode 100644 www/test.html diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c0f3bb9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3.6' +services: + nginx: + image: nginx:1.21.6 + container_name: nginx + ports: + - '12345:80' + networks: + - my_app + volumes: + - './www:/usr/share/nginx/html:ro' + - './nginx.conf:/etc/nginx/nginx.conf:ro' + + php: + image: php:8.1-fpm-alpine + container_name: php + networks: + - my_app + volumes: + - './www:/app:ro' + +networks: + my_app: \ No newline at end of file diff --git a/fastcgi.conf b/fastcgi.conf new file mode 100644 index 0000000..20b355d --- /dev/null +++ b/fastcgi.conf @@ -0,0 +1,18 @@ +#fastcgi.conf +fastcgi_param GATEWAY_INTERFACE CGI/1.1; +fastcgi_param SERVER_SOFTWARE nginx; +fastcgi_param QUERY_STRING $query_string; +fastcgi_param REQUEST_METHOD $request_method; +fastcgi_param CONTENT_TYPE $content_type; +fastcgi_param CONTENT_LENGTH $content_length; +fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; +fastcgi_param SCRIPT_NAME $fastcgi_script_name; +fastcgi_param REQUEST_URI $request_uri; +fastcgi_param DOCUMENT_URI $document_uri; +fastcgi_param DOCUMENT_ROOT $document_root; +fastcgi_param SERVER_PROTOCOL $server_protocol; +fastcgi_param REMOTE_ADDR $remote_addr; +fastcgi_param REMOTE_PORT $remote_port; +fastcgi_param SERVER_ADDR $server_addr; +fastcgi_param SERVER_PORT $server_port; +fastcgi_param SERVER_NAME $server_name; \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..bb7b463 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,41 @@ +user nginx; +worker_processes 1; + +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; + keepalive_timeout 65; + server_tokens off; + + server { + listen 80; + server_name my.app; + + root /app; + + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ =404; + } + + location ~ \.php$ { + root /usr/share/nginx/html; + include fastcgi_params; + fastcgi_pass php:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME /app/$fastcgi_script_name; + } + } +} diff --git a/www/app.html b/www/app.html new file mode 100644 index 0000000..d511639 --- /dev/null +++ b/www/app.html @@ -0,0 +1,9 @@ + + + + App html + + +

Application HTML

+ + \ No newline at end of file diff --git a/www/app.php b/www/app.php new file mode 100644 index 0000000..7a6bd24 --- /dev/null +++ b/www/app.php @@ -0,0 +1,12 @@ + + + + + App php + + +

+ + \ No newline at end of file diff --git a/www/test.html b/www/test.html new file mode 100644 index 0000000..d69adab --- /dev/null +++ b/www/test.html @@ -0,0 +1,9 @@ + + + + Test html + + +

Test HTML

+ + \ No newline at end of file