]> juplo.de Git - website/commitdiff
WIP:fpm-chatgpt
authorKai Moritz <kai@juplo.de>
Tue, 18 Nov 2025 22:06:27 +0000 (23:06 +0100)
committerKai Moritz <kai@juplo.de>
Tue, 18 Nov 2025 22:06:27 +0000 (23:06 +0100)
docker-compose.yml
nginx.conf
snippets/fastcgi-php.conf [new file with mode: 0644]
snippets/security.conf [new file with mode: 0644]

index f5350f08ecfce866aa22f9a7b76d5efd381997d2..8ad74de8132cd302d0a2ab6b415620fb368b8b8e 100644 (file)
@@ -8,13 +8,14 @@ services:
     volumes:
       - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
       - ./:/usr/share/nginx/html:ro
+      - ./snippets:/etc/nginx/snippets:ro
+      - ./wordpress-fpm:/var/www/html:ro
   wordpress:
     image: wordpress:6.3.2-php8.2-fpm
     read_only: true
     depends_on:
       - mariadb
     environment:
-      SCRIPT_FILENAME: /usr/src/wordpress
       WORDPRESS_DB_HOST: mariadb:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: I0vAUXKC
index f7cb1d3b09bb9c48caa06603cc66b4dcec30c2de..279743721760092bbd76cf7d7e984217174b923e 100644 (file)
@@ -1,28 +1,25 @@
 server {
     listen 80;
-    server_name localhost;
+    server_name _;
+
     root /var/www/html;
+    index index.php index.html index.htm;
 
-    index index.php;
+    include /etc/nginx/snippets/security.conf;
 
     location / {
         try_files $uri $uri/ /index.php?$args;
     }
 
-    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
-
-    location ~ [^/]\.php(/|$) {
-        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
-        if (!-f $document_root$fastcgi_script_name) {
-            return 404;
-        }
-
-        include fastcgi_params;
-        fastcgi_pass     wordpress:9000;
-        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-        fastcgi_param PATH_INFO             $fastcgi_path_info;
-        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
+    location ~ \.php$ {
+        include /etc/nginx/snippets/fastcgi-php.conf;
+        fastcgi_pass wordpress:9000;
+    }
 
-        fastcgi_index    index.php; 
+    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
+        expires max;
+        log_not_found off;
     }
+
+    client_max_body_size 64M;
 }
diff --git a/snippets/fastcgi-php.conf b/snippets/fastcgi-php.conf
new file mode 100644 (file)
index 0000000..71a5d58
--- /dev/null
@@ -0,0 +1,10 @@
+fastcgi_split_path_info ^(.+\.php)(/.+)$;
+fastcgi_index index.php;
+include fastcgi_params;
+
+fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+fastcgi_param PATH_INFO $fastcgi_path_info;
+
+fastcgi_buffer_size 32k;
+fastcgi_buffers 4 32k;
+fastcgi_busy_buffers_size 64k;
diff --git a/snippets/security.conf b/snippets/security.conf
new file mode 100644 (file)
index 0000000..3ea221e
--- /dev/null
@@ -0,0 +1,11 @@
+add_header X-Frame-Options "SAMEORIGIN" always;
+add_header X-XSS-Protection "1; mode=block" always;
+add_header X-Content-Type-Options "nosniff" always;
+
+location ~* \.(svn|git|hg|bzr)$ {
+    deny all;
+}
+
+location ~* wp-config.php {
+    deny all;
+}