This commit is contained in:
thethinkloops
2025-12-26 17:20:16 +05:30
parent 80bd6ebe74
commit 36f79f374d
2 changed files with 47 additions and 0 deletions

15
Dockerfile Normal file
View File

@@ -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;'"]

32
nginx.conf Normal file
View File

@@ -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;
}
}
}