Browse Source

Updated PHP 8.2.

This is working with nginx and socket.
Using alpine 3.18 (not alpine:latest).
We want this tied to a version.
Steve Thielemann 1 year ago
parent
commit
af5d2b9ec9
8 changed files with 55 additions and 46 deletions
  1. 11 13
      docker-compose.yml
  2. 9 0
      html/index.html
  3. 3 0
      html/phpinfo.php
  4. 11 17
      nginx.conf
  5. 1 1
      nginx/Dockerfile
  6. 16 12
      php-image/Dockerfile
  7. 1 1
      php-image/www.conf
  8. 3 2
      reset.sh

+ 11 - 13
docker-compose.yml

@@ -11,7 +11,7 @@ services:
       - ./html:/usr/share/nginx/html      
       # Fancy!  Using sockets to connect to php-fpm!  :D
       - ./socks:/socks
-      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
+      - ./nginx.conf:/etc/nginx/http.d/default.conf:ro
       # - ./more.conf:/etc/nginx/modules/more.conf:ro
 
   # restart: always
@@ -20,23 +20,21 @@ services:
     build: php-image
 
     volumes:
-      # AFter setup, down LocalSettings.php and use it here
       - ./socks:/socks
       - /etc/localtime:/etc/localtime:ro
       - ./html:/usr/share/nginx/html
-      - ./LocalSettings.php:/usr/share/nginx/html/LocalSettings.php
     # restart: always  
       
-  db:
-    image: postgres:11-alpine
-    volumes:
-      - ./pg_data:/var/lib/postgresql/data
-      - /etc/localtime:/etc/localtime:ro
-    environment:
-      POSTGRES_PASSWORD: easy4me2remember
-      POSTGRES_DB: mediawiki
-      POSTGRES_USER: mediawiki
-    user: "1000:1000"
+  # db:
+  #  image: postgres:11-alpine
+  #  volumes:
+  #    - ./pg_data:/var/lib/postgresql/data
+  #    - /etc/localtime:/etc/localtime:ro
+  #  environment:
+  #    POSTGRES_PASSWORD: easy4me2remember
+  #    POSTGRES_DB: mediawiki
+  #    POSTGRES_USER: mediawiki
+  #  user: "1000:1000"
 
   redis:
     image: redis:5-alpine

+ 9 - 0
html/index.html

@@ -0,0 +1,9 @@
+<html>
+<head>
+<title>Welcome</title>
+</head>
+<body>
+<h2>Welcome to nginx.</h2>
+</body>
+</html>
+

+ 3 - 0
html/phpinfo.php

@@ -0,0 +1,3 @@
+<?php
+phpinfo();
+

+ 11 - 17
nginx.conf

@@ -28,8 +28,8 @@ server {
    #   try_files $uri $uri/ /index.php;
    # }
 
-   location ~ ^/(index|load|api|thumb|opensearch_desc)\.php$ {
-   # location ~* \.php$ {
+   # location ~ ^/(index|load|api|thumb|opensearch_desc)\.php$ {
+   location ~* \.php$ {
      # fastcgi_pass php:9000;
      # include fastcgi.conf;
 
@@ -40,13 +40,6 @@ server {
      # or possibly include fastcgi_params; ?
    }
 
-   location /images {
-   }
-
-   location /images/deleted {
-     deny all;
-   }
-
    location ~ ^/resources/(assets|lib|src) {
      try_files $uri 404;
      add_header Cache-Control "public";
@@ -59,15 +52,16 @@ server {
      expires 1d;
    }
 
-   location = /favicon.ico {
-     alias /images/6/64/Favicon.ico;
-     # add_header Cache-Control "public";
-     # expires 1d;
-   }
 
-   location /wiki/ {
-     rewrite ^/wiki/(?<pagename>.*)$ /index.php;
-   }
+   # location = /favicon.ico {
+   #   alias /images/6/64/Favicon.ico;
+   #   # add_header Cache-Control "public";
+   #   # expires 1d;
+   # }
+
+   # location /wiki/ {
+   #   rewrite ^/wiki/(?<pagename>.*)$ /index.php;
+   # }
 
 }
 

+ 1 - 1
nginx/Dockerfile

@@ -1,4 +1,4 @@
-FROM alpine:3.10
+FROM alpine:3.18
 LABEL maintainer="Bugz Software <[email protected]>"
 STOPSIGNAL SIGTERM
 RUN apk --no-cache add nginx nginx-mod-http-headers-more \

+ 16 - 12
php-image/Dockerfile

@@ -1,21 +1,25 @@
 
-FROM alpine:latest
-# RUN apk -U --no-cache add \
-#   php7-fpm php7-gd php7-intl php7-json php7-pecl-redis php7-opcache php7-mysqli php7-pdo_mysql php7-pgsql php7-pdo_pgsql php7-sqlite3 \
-#   php7-pdo_sqlite php7-mbstring php7-xml php7-phar php7-iconv
+FROM alpine:3.18
 
-RUN apk -U --no-cache add \
-  php7-fpm php7-gd php7-intl php7-json php7-pecl-redis php7-opcache php7-pgsql php7-pdo_pgsql \
-  php7-mbstring php7-xml php7-phar php7-iconv php7-ctype php7-fileinfo php7-dom php7-pecl-apcu php7-openssl \
-  && addgroup -g 1000 www-data \
-  && adduser -D -G www-data -u 1000 www-data
+# RUN addgroup -g 1000 www-data \
+#   && adduser -D -G www-data -u 1000 www-data \
 
-COPY www.conf /etc/php7/php-fpm.d/www.conf
+RUN adduser -D -G www-data -u 1000 www-data \
+  && apk -U --no-cache add shadow \
+  php82-fpm php82-gd php82-intl php82-json php82-pecl-redis php82-opcache php82-pgsql php82-pdo_pgsql \
+  php82-mysqlnd php82-pdo_mysql \
+  php82-mbstring php82-xml php82-phar php82-iconv php82-ctype php82-fileinfo php82-dom php82-pecl-apcu php82-openssl \
+  && groupmod --gid 1000 www-data 
+
+# RUN curl -sS https://getcomposer.org/installer | php -- \
+# --install-dir=/usr/bin --filename=composer && chmod +x /usr/bin/composer   
+
+COPY www.conf /etc/php82/php-fpm.d/www.conf
 # COPY opcache.ini /usr/local/etc/php/conf.d/opcache.ini
-COPY date.ini /etc/php7/conf.d/datetimezone.ini
+COPY date.ini /etc/php82/conf.d/datetimezone.ini
 # COPY session.ini /etc/php7/conf.d/session.ini
 # COPY redis.ini /usr/local/etc/php/conf.d/redis.ini
 VOLUME /socks
 
-CMD ["php-fpm7", "-F"] 
+CMD ["php-fpm82", "-F"] 
 

+ 1 - 1
php-image/www.conf

@@ -497,7 +497,7 @@ pm.max_spare_servers = 3
 ; Note: on highloaded environement, this can cause some delay in the page
 ; process time (several ms).
 ; Default Value: no
-;catch_workers_output = yes
+catch_workers_output = yes
 
 ; Clear environment in FPM workers
 ; Prevents arbitrary environment variables from reaching FPM worker processes

+ 3 - 2
reset.sh

@@ -1,9 +1,10 @@
 #!/bin/bash
 
-sudo rm -rf pg_data
-mkdir pg_data
+# sudo rm -rf pg_data
+# mkdir pg_data
 sudo rm -rf redis
 mkdir redis
 sudo rm -rf socks
 mkdir socks
+sudo chown -R 1000:1000 socks html redis