From 34148ff7d34bb436e3d9c3b07576f1e47a1dee58 Mon Sep 17 00:00:00 2001 From: status404 Date: Sat, 2 Nov 2024 17:32:33 +0300 Subject: [PATCH] add dockerfile and config --- docker-compose.yml | 13 +++++++++++++ docker/Dockerfile | 5 +++++ docker/nginx.conf | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile create mode 100644 docker/nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7fd6bff --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + nginx: + build: + context: ./docker + dockerfile: Dockerfile + image: bitdeals/nginx + volumes: + - php_socket:/run + - storage:/app/storage/:ro + - public:/app/public/:ro + depends_on: + - php-app + diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..60a2464 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,5 @@ +FROM bitnami/nginx:latest + +# Copy config +COPY ./docker/nginx.conf /opt/bitnami/nginx/conf/server_blocks/nginx.conf + diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 0000000..211ad1c --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,45 @@ +server { + + listen 80 default_server; + server_name _; + + root /app/public; + + #add_header X-Frame-Options "SAMEORIGIN"; + #add_header X-XSS-Protection "1; mode=block"; + #add_header X-Content-Type-Options "nosniff"; + #add_header X-Forwarded-Proto https; + add_header 'Access-Control-Allow-Origin' '*'; + + index index.html index.htm index.php; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + #error_log /var/log/nginx/container_error.log; + #access_log /var/log/nginx/container_access.log; + + error_page 404 /index.php; + + location ~ \.php$ { + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + #fastcgi_split_path_info ^(.+\.php)(/.+)$; + + fastcgi_pass unix:/run/php-fpm.sock; + #fastcgi_pass php-app:9000; + + fastcgi_index index.php; + include fastcgi_params; + } + + location ~ /\.(?!well-known).* { + deny all; + } +} +