From 36f79f374d1f86b34ae29c184312f4a66bd223bc Mon Sep 17 00:00:00 2001 From: thethinkloops Date: Fri, 26 Dec 2025 17:20:16 +0530 Subject: [PATCH] 26122025 --- Dockerfile | 15 +++++++++++++++ nginx.conf | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b273d65 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM php:8.2-fpm-alpine + +RUN apk add --no-cache nginx + +WORKDIR /var/www/html +COPY . /var/www/html + +COPY nginx.conf /etc/nginx/nginx.conf + +RUN chown -R www-data:www-data /var/www/html +RUN mkdir -p /run/nginx + +EXPOSE 80 + +CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..a00ee65 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,32 @@ +events {} + +http { + include mime.types; + default_type application/octet-stream; + + server { + listen 80; + server_name localhost; + + root /var/www/html; + index index.php; + + # 1️⃣ Serve static files directly + location ~* \.(css|js|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf)$ { + try_files $uri =404; + } + + # 2️⃣ ALL routes → index.php + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + # 3️⃣ PHP execution + location ~ \.php$ { + include fastcgi_params; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + } +}