From f441cc93c2b4d9084f9e9e725f07a487b26cee1a Mon Sep 17 00:00:00 2001 From: emirlike Date: Sun, 18 Sep 2022 17:19:23 +0200 Subject: [PATCH 1/8] added pcov and gmp --- files/php/bin_install_modules.sh | 2 ++ files/php/bin_link_ini.sh | 2 ++ files/php/bin_rm_symlinked_ini.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/files/php/bin_install_modules.sh b/files/php/bin_install_modules.sh index 11c5d29..0e236ef 100644 --- a/files/php/bin_install_modules.sh +++ b/files/php/bin_install_modules.sh @@ -25,12 +25,14 @@ MODULES_OPTIONAL=" php${PHP_VER}-amqp php${PHP_VER}-apcu php${PHP_VER}-gd + php${PHP_VER}-gmp php${PHP_VER}-igbinary php${PHP_VER}-imagick php${PHP_VER}-mailparse php${PHP_VER}-memcached php${PHP_VER}-mongodb php${PHP_VER}-oauth + php${PHP_VER}-pcov php${PHP_VER}-raphf php${PHP_VER}-redis php${PHP_VER}-soap diff --git a/files/php/bin_link_ini.sh b/files/php/bin_link_ini.sh index 085abfc..e6524a8 100644 --- a/files/php/bin_link_ini.sh +++ b/files/php/bin_link_ini.sh @@ -11,11 +11,13 @@ EXTRA_MODS=( amqp apcu gd + gmp imagick mailparse memcached mongodb oauth + pcov pdo_sqlite raphf redis diff --git a/files/php/bin_rm_symlinked_ini.sh b/files/php/bin_rm_symlinked_ini.sh index 3240013..92e87b8 100644 --- a/files/php/bin_rm_symlinked_ini.sh +++ b/files/php/bin_rm_symlinked_ini.sh @@ -22,6 +22,7 @@ function rm_symlinked_ini() { /etc/php/${PHP_VER}/${TYPE}/conf.d/20-apcu.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/25-apcu_bc.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-gd.ini \ + /etc/php/${PHP_VER}/${TYPE}/conf.d/20-gmp.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-geoip.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-gnupg.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-imagick.ini \ @@ -29,6 +30,7 @@ function rm_symlinked_ini() { /etc/php/${PHP_VER}/${TYPE}/conf.d/25-memcached.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-mongodb.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-oauth.ini \ + /etc/php/${PHP_VER}/${TYPE}/conf.d/20-pcov.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-pdo_sqlite.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-radius.ini \ /etc/php/${PHP_VER}/${TYPE}/conf.d/20-raphf.ini \ From 1340495407efaeb05f4b8a38253d57c460d703d5 Mon Sep 17 00:00:00 2001 From: emirlike Date: Sun, 18 Sep 2022 17:22:21 +0200 Subject: [PATCH 2/8] enabled user configuration, set to user www (1000:1000) --- Dockerfile-apache | 2 +- Dockerfile-nginx | 4 ++-- Dockerfile-php-cli | 12 ++++++++++-- Dockerfile-php-fpm | 2 +- files/nginx/nginx.conf | 2 +- files/php/bin_install_composer.sh | 4 ++-- files/php/fpm.conf | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Dockerfile-apache b/Dockerfile-apache index 7ce8320..9b1042c 100644 --- a/Dockerfile-apache +++ b/Dockerfile-apache @@ -13,7 +13,7 @@ RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/apache2/ubuntu bion RUN a2enmod env headers proxy proxy_http proxy_fcgi rewrite # Set proper permissions for Apache -RUN chown -R www-data:www-data \ +RUN chown -R www:www \ /var/www &&\ rm -rf /var/www/html diff --git a/Dockerfile-nginx b/Dockerfile-nginx index 172b896..eb487e3 100644 --- a/Dockerfile-nginx +++ b/Dockerfile-nginx @@ -12,10 +12,10 @@ RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/nginx/ubuntu bionic rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} # Set proper permissions for Nginx -RUN chown -R www-data:www-data \ +RUN chown -R www:www \ /var/lib/nginx \ /var/www &&\ - install -d -m 0755 -o www-data -g www-data \ + install -d -m 0755 -o www -g www \ /var/cache/nginx \ /var/run/nginx &&\ rm -rf /var/www/html diff --git a/Dockerfile-php-cli b/Dockerfile-php-cli index 8f04531..05ad4ff 100644 --- a/Dockerfile-php-cli +++ b/Dockerfile-php-cli @@ -4,6 +4,14 @@ LABEL maintainer="Juan Treminio " ENV DEBIAN_FRONTEND=noninteractive ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn + +# set container user +ARG WWWGID=1000 +ARG WWWUID=1000 +RUN groupadd --force -g $WWWGID www \ + && useradd -ms /bin/bash --no-user-group -g $WWWGID -u $WWWUID www + + RUN update-alternatives --install /bin/sh sh /bin/bash 100 RUN mkdir /docker_build @@ -32,7 +40,7 @@ RUN /docker_build/bin_install_composer.sh &&\ COPY files/php/php.ini /etc/php/php.ini # Default sessions directory -RUN install -d -m 0755 -o www-data -g www-data /var/lib/php/sessions +RUN install -d -m 0755 -o www -g www /var/lib/php/sessions # Xdebug CLI debugging COPY files/php/xdebug /usr/bin/xdebug @@ -40,4 +48,4 @@ RUN chmod +x /usr/bin/xdebug WORKDIR /etc/php/${PHP_VER} -USER www-data +USER www diff --git a/Dockerfile-php-fpm b/Dockerfile-php-fpm index 3872867..57497c3 100644 --- a/Dockerfile-php-fpm +++ b/Dockerfile-php-fpm @@ -38,7 +38,7 @@ COPY files/php/php-fpm /etc/service/fpm/run RUN chmod +x /etc/service/fpm/run # PID directory -RUN install -d -m 0755 -o www-data -g www-data /var/run/php-fpm +RUN install -d -m 0755 -o www -g www /var/run/php-fpm EXPOSE 9000 diff --git a/files/nginx/nginx.conf b/files/nginx/nginx.conf index 9339468..2824c90 100644 --- a/files/nginx/nginx.conf +++ b/files/nginx/nginx.conf @@ -1,6 +1,6 @@ # /etc/nginx/nginx.conf -user www-data; +user www; worker_processes auto; pid /var/run/nginx/nginx.pid; diff --git a/files/php/bin_install_composer.sh b/files/php/bin_install_composer.sh index 74a63f7..04e417c 100644 --- a/files/php/bin_install_composer.sh +++ b/files/php/bin_install_composer.sh @@ -5,8 +5,8 @@ set -x # Installs Composer -install -d -m 0755 -o www-data -g www-data /.composer &&\ +install -d -m 0755 -o www -g www /.composer &&\ curl -sS https://getcomposer.org/installer | \ php -- --install-dir=/usr/local/bin \ --filename=composer &&\ -chown -R www-data:www-data /.composer +chown -R www:www /.composer diff --git a/files/php/fpm.conf b/files/php/fpm.conf index b137687..517552f 100644 --- a/files/php/fpm.conf +++ b/files/php/fpm.conf @@ -5,7 +5,7 @@ pid = ${FPM.pid} error_log = /proc/self/fd/2 [www] -user = www-data +user = www listen = ${FPM.listen} ; Redirect logs to stdout - FPM closes /dev/std* on startup access.log = /proc/self/fd/2 From fb4bc21d5f286e102129b0756a824774325d9c6f Mon Sep 17 00:00:00 2001 From: emirlike Date: Sun, 18 Sep 2022 17:55:17 +0200 Subject: [PATCH 3/8] removed mbstring deprecated directives --- Dockerfile-env | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile-env b/Dockerfile-env index 62b6a72..a664425 100644 --- a/Dockerfile-env +++ b/Dockerfile-env @@ -306,9 +306,6 @@ ENV PHP.allow_url_fopen=1 \ PHP.mbstring.detect_order= \ PHP.mbstring.encoding_translation=0 \ PHP.mbstring.func_overload=0 \ - PHP.mbstring.http_input= \ - PHP.mbstring.http_output= \ - PHP.mbstring.internal_encoding= \ PHP.mbstring.language=neutral \ PHP.mbstring.script_encoding= \ PHP.mbstring.strict_detection=0 \ From 59592fb006487051e3a2a63c6b2d33345f9cc0b6 Mon Sep 17 00:00:00 2001 From: emirlike Date: Sun, 18 Sep 2022 18:13:01 +0200 Subject: [PATCH 4/8] removed mbstring deprecated directives --- Dockerfile-nginx | 4 ++-- files/php/php.ini | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile-nginx b/Dockerfile-nginx index eb487e3..172b896 100644 --- a/Dockerfile-nginx +++ b/Dockerfile-nginx @@ -12,10 +12,10 @@ RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/nginx/ubuntu bionic rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} # Set proper permissions for Nginx -RUN chown -R www:www \ +RUN chown -R www-data:www-data \ /var/lib/nginx \ /var/www &&\ - install -d -m 0755 -o www -g www \ + install -d -m 0755 -o www-data -g www-data \ /var/cache/nginx \ /var/run/nginx &&\ rm -rf /var/www/html diff --git a/files/php/php.ini b/files/php/php.ini index 2e2daf0..0f082c0 100644 --- a/files/php/php.ini +++ b/files/php/php.ini @@ -337,9 +337,6 @@ maxdb.long_readlen = ${PHP.maxdb.long_readlen} mbstring.detect_order = ${PHP.mbstring.detect_order} mbstring.encoding_translation = ${PHP.mbstring.encoding_translation} mbstring.func_overload = ${PHP.mbstring.func_overload} -mbstring.http_input = ${PHP.mbstring.http_input} -mbstring.http_output = ${PHP.mbstring.http_output} -mbstring.internal_encoding = ${PHP.mbstring.internal_encoding} mbstring.language = ${PHP.mbstring.language} mbstring.script_encoding = ${PHP.mbstring.script_encoding} mbstring.strict_detection = ${PHP.mbstring.strict_detection} From 015bdfaff11c6797d712a4c7d99a4d416d354933 Mon Sep 17 00:00:00 2001 From: emirlike Date: Sun, 18 Sep 2022 22:50:02 +0200 Subject: [PATCH 5/8] enabled setting of nginx port with env variable --- Dockerfile-apache | 1 + Dockerfile-nginx | 1 + files/apache/ports.conf | 2 +- files/apache/vhost/drupal.conf | 2 +- files/apache/vhost/fpm.conf | 2 +- files/apache/vhost/html.conf | 2 +- files/apache/vhost/laravel.conf | 2 +- files/apache/vhost/symfony2.conf | 2 +- files/apache/vhost/symfony3.conf | 2 +- files/apache/vhost/symfony4.conf | 2 +- files/apache/vhost/wordpress.conf | 2 +- files/nginx/nginx | 10 +++++++++- files/nginx/nginx.conf | 7 +++++-- files/nginx/vhost/drupal6.conf | 2 +- files/nginx/vhost/drupal7.conf | 2 +- files/nginx/vhost/drupal8.conf | 2 +- files/nginx/vhost/fpm.conf | 2 +- files/nginx/vhost/html.conf | 2 +- files/nginx/vhost/laravel.conf | 2 +- files/nginx/vhost/symfony2-dev.conf | 2 +- files/nginx/vhost/symfony2-prod.conf | 2 +- files/nginx/vhost/symfony3-dev.conf | 2 +- files/nginx/vhost/symfony3-prod.conf | 2 +- files/nginx/vhost/symfony4.conf | 2 +- files/nginx/vhost/wordpress.conf | 2 +- 25 files changed, 37 insertions(+), 24 deletions(-) diff --git a/Dockerfile-apache b/Dockerfile-apache index 9b1042c..3b48ae8 100644 --- a/Dockerfile-apache +++ b/Dockerfile-apache @@ -2,6 +2,7 @@ ARG PHP_VER_DOT FROM jtreminio/php:$PHP_VER_DOT LABEL maintainer="Juan Treminio " + RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/apache2/ubuntu bionic main\n" \ >/etc/apt/sources.list.d/ondrej-apache2.list &&\ apt-get update &&\ diff --git a/Dockerfile-nginx b/Dockerfile-nginx index 172b896..634f66b 100644 --- a/Dockerfile-nginx +++ b/Dockerfile-nginx @@ -2,6 +2,7 @@ ARG PHP_VER_DOT FROM jtreminio/php:$PHP_VER_DOT LABEL maintainer="Juan Treminio " + RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/nginx/ubuntu bionic main\n" \ >/etc/apt/sources.list.d/ondrej-nginx.list &&\ apt-get update &&\ diff --git a/files/apache/ports.conf b/files/apache/ports.conf index f86d675..e3189dc 100644 --- a/files/apache/ports.conf +++ b/files/apache/ports.conf @@ -2,4 +2,4 @@ ServerName localhost -Listen 8080 +Listen ${CONTAINER_PORT} diff --git a/files/apache/vhost/drupal.conf b/files/apache/vhost/drupal.conf index 08dc89a..dac7e02 100644 --- a/files/apache/vhost/drupal.conf +++ b/files/apache/vhost/drupal.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/drupal.conf # Drupal - + ServerName default.localhost ServerAlias * diff --git a/files/apache/vhost/fpm.conf b/files/apache/vhost/fpm.conf index cd9f169..a08ba3c 100644 --- a/files/apache/vhost/fpm.conf +++ b/files/apache/vhost/fpm.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/fpm.conf # Basic FPM - + ServerName default.localhost ServerAlias * diff --git a/files/apache/vhost/html.conf b/files/apache/vhost/html.conf index 00f66b6..7168dc8 100644 --- a/files/apache/vhost/html.conf +++ b/files/apache/vhost/html.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/html.conf # Basic HTML - + ServerName default.localhost ServerAlias * diff --git a/files/apache/vhost/laravel.conf b/files/apache/vhost/laravel.conf index 145f8b3..5016492 100644 --- a/files/apache/vhost/laravel.conf +++ b/files/apache/vhost/laravel.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/laravel.conf # Laravel - + ServerName default.localhost ServerAlias * diff --git a/files/apache/vhost/symfony2.conf b/files/apache/vhost/symfony2.conf index ec0eb22..2f44d44 100644 --- a/files/apache/vhost/symfony2.conf +++ b/files/apache/vhost/symfony2.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/symfony2.conf # Symfony 2 - + ServerName default.localhost ServerAlias * diff --git a/files/apache/vhost/symfony3.conf b/files/apache/vhost/symfony3.conf index 78cbc43..aa7bbab 100644 --- a/files/apache/vhost/symfony3.conf +++ b/files/apache/vhost/symfony3.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/symfony3.conf # Symfony 3 - + ServerName default.localhost ServerAlias * diff --git a/files/apache/vhost/symfony4.conf b/files/apache/vhost/symfony4.conf index 712bdc5..e81ce55 100644 --- a/files/apache/vhost/symfony4.conf +++ b/files/apache/vhost/symfony4.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/symfony4.conf # Symfony 4 - + ServerName default.localhost ServerAlias * diff --git a/files/apache/vhost/wordpress.conf b/files/apache/vhost/wordpress.conf index afc228d..48cf733 100644 --- a/files/apache/vhost/wordpress.conf +++ b/files/apache/vhost/wordpress.conf @@ -1,7 +1,7 @@ # /etc/apache2/sites-available/wordpress.conf # Wordpress - + ServerName default.localhost ServerAlias * diff --git a/files/nginx/nginx b/files/nginx/nginx index 5ce9543..b910c1f 100644 --- a/files/nginx/nginx +++ b/files/nginx/nginx @@ -19,6 +19,14 @@ if [[ ! -f /etc/nginx/sites-enabled/default ]]; then echo Using /etc/nginx/sites-available/${VHOST} ln -s /etc/nginx/sites-available/${VHOST} /etc/nginx/sites-enabled/default + + # passing the CONTAINER_PORT env through perl doesn't work. This is a workaround + sed -i 's/\$[{]nginxport[}]/'${CONTAINER_PORT}'/' /etc/nginx/sites-enabled/default fi -exec nginx -g "daemon off; env PHPFPM_XDEBUG_PORT=${PHPFPM_XDEBUG_PORT};" +exec nginx -g "daemon off; env PHPFPM_XDEBUG_PORT=${PHPFPM_XDEBUG_PORT}; env CONTAINER_PORT=${CONTAINER_PORT};" + + + + + diff --git a/files/nginx/nginx.conf b/files/nginx/nginx.conf index 2824c90..16b5931 100644 --- a/files/nginx/nginx.conf +++ b/files/nginx/nginx.conf @@ -6,6 +6,8 @@ worker_processes auto; pid /var/run/nginx/nginx.pid; include /etc/nginx/modules-enabled/*.conf; + + error_log /dev/stderr warn; events { @@ -47,6 +49,7 @@ http { # Default to NOT using Xdebug, falling back to standard :9000 for PHP-FPM perl_set $phpfpm_xdebug_port 'sub { return $ENV{"PHPFPM_XDEBUG_PORT"}; }'; - + perl_set $nginxport 'sub { return $ENV{"CONTAINER_PORT"}; }'; + include /etc/nginx/sites-enabled/default; -} +} \ No newline at end of file diff --git a/files/nginx/vhost/drupal6.conf b/files/nginx/vhost/drupal6.conf index 86fb3e4..a1ae18c 100644 --- a/files/nginx/vhost/drupal6.conf +++ b/files/nginx/vhost/drupal6.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www; diff --git a/files/nginx/vhost/drupal7.conf b/files/nginx/vhost/drupal7.conf index 668e103..8f0f8ad 100644 --- a/files/nginx/vhost/drupal7.conf +++ b/files/nginx/vhost/drupal7.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www; diff --git a/files/nginx/vhost/drupal8.conf b/files/nginx/vhost/drupal8.conf index 34b4c5c..9d7298e 100644 --- a/files/nginx/vhost/drupal8.conf +++ b/files/nginx/vhost/drupal8.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www; diff --git a/files/nginx/vhost/fpm.conf b/files/nginx/vhost/fpm.conf index 966e1be..1fd6e2b 100644 --- a/files/nginx/vhost/fpm.conf +++ b/files/nginx/vhost/fpm.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www; diff --git a/files/nginx/vhost/html.conf b/files/nginx/vhost/html.conf index 7e9298d..978b1d6 100644 --- a/files/nginx/vhost/html.conf +++ b/files/nginx/vhost/html.conf @@ -2,7 +2,7 @@ # Basic HTML server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www; diff --git a/files/nginx/vhost/laravel.conf b/files/nginx/vhost/laravel.conf index 647124a..9814eff 100644 --- a/files/nginx/vhost/laravel.conf +++ b/files/nginx/vhost/laravel.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www/public; diff --git a/files/nginx/vhost/symfony2-dev.conf b/files/nginx/vhost/symfony2-dev.conf index d4a12d4..7e4cd8f 100644 --- a/files/nginx/vhost/symfony2-dev.conf +++ b/files/nginx/vhost/symfony2-dev.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www/web; diff --git a/files/nginx/vhost/symfony2-prod.conf b/files/nginx/vhost/symfony2-prod.conf index 6be0af7..1073da5 100644 --- a/files/nginx/vhost/symfony2-prod.conf +++ b/files/nginx/vhost/symfony2-prod.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www/web; diff --git a/files/nginx/vhost/symfony3-dev.conf b/files/nginx/vhost/symfony3-dev.conf index 7c4de2f..691cbab 100644 --- a/files/nginx/vhost/symfony3-dev.conf +++ b/files/nginx/vhost/symfony3-dev.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www/web; diff --git a/files/nginx/vhost/symfony3-prod.conf b/files/nginx/vhost/symfony3-prod.conf index 5db6b45..ce1a4b9 100644 --- a/files/nginx/vhost/symfony3-prod.conf +++ b/files/nginx/vhost/symfony3-prod.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www/web; diff --git a/files/nginx/vhost/symfony4.conf b/files/nginx/vhost/symfony4.conf index 8685aae..4f594f4 100644 --- a/files/nginx/vhost/symfony4.conf +++ b/files/nginx/vhost/symfony4.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www/public; diff --git a/files/nginx/vhost/wordpress.conf b/files/nginx/vhost/wordpress.conf index fb04607..f600f63 100644 --- a/files/nginx/vhost/wordpress.conf +++ b/files/nginx/vhost/wordpress.conf @@ -7,7 +7,7 @@ map $cookie_XDEBUG_SESSION $my_fastcgi_pass { } server { - listen *:8080 default_server; + listen *:${nginxport} default_server; server_name _; root /var/www; From 64790df34cdcdb2fa4d222263b5b873c432dc735 Mon Sep 17 00:00:00 2001 From: emirlike Date: Mon, 19 Sep 2022 19:47:51 +0200 Subject: [PATCH 6/8] boh --- Dockerfile-nginx | 4 ++-- build | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile-nginx b/Dockerfile-nginx index 634f66b..ca5e227 100644 --- a/Dockerfile-nginx +++ b/Dockerfile-nginx @@ -13,10 +13,10 @@ RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/nginx/ubuntu bionic rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} # Set proper permissions for Nginx -RUN chown -R www-data:www-data \ +RUN chown -R www:www \ /var/lib/nginx \ /var/www &&\ - install -d -m 0755 -o www-data -g www-data \ + install -d -m 0755 -o www -g www \ /var/cache/nginx \ /var/run/nginx &&\ rm -rf /var/www/html diff --git a/build b/build index c9b722a..e261b3a 100755 --- a/build +++ b/build @@ -191,7 +191,7 @@ function build_php_cli_image() { PHP_MINOR="${2}" echo "Building PHP-CLI ${PHP_MINOR}" - docker image build \ + docker image build --no-cache \ --build-arg PHP_VER=${PHP_MAJOR} \ --build-arg PHP_VER_DOT=${PHP_MINOR} \ -t jtreminio/php-cli:${PHP_MAJOR} \ @@ -210,7 +210,7 @@ function build_php_fpm_image() { PHP_MINOR="${2}" echo "Building PHP-CLI + PHP-FPM ${PHP_MINOR}" - docker image build \ + docker image build --no-cache \ --build-arg PHP_VER=${PHP_MAJOR} \ --build-arg PHP_VER_DOT=${PHP_MINOR} \ -t jtreminio/php:${PHP_MAJOR} \ @@ -229,7 +229,7 @@ function build_apache_image() { PHP_MINOR="${2}" echo "Building PHP ${PHP_MAJOR} + Apache" - docker image build \ + docker image build --no-cache \ --build-arg PHP_VER_DOT=${PHP_MINOR} \ -t jtreminio/php-apache:${PHP_MAJOR} \ -t jtreminio/php-apache:${PHP_MINOR} \ @@ -247,7 +247,7 @@ function build_nginx_image() { PHP_MINOR="${2}" echo "Building PHP ${PHP_MAJOR} + Nginx" - docker image build \ + docker image build --no-cache \ --build-arg PHP_VER_DOT=${PHP_MINOR} \ -t jtreminio/php-nginx:${PHP_MAJOR} \ -t jtreminio/php-nginx:${PHP_MINOR} \ From fdad76c297e3176c44e3ffceb863ef2171b05875 Mon Sep 17 00:00:00 2001 From: emirlike Date: Sat, 22 Jul 2023 20:22:50 -0700 Subject: [PATCH 7/8] small improvements --- build | 8 ++++---- files/nginx/nginx | 10 +--------- files/php/bin_install_composer.sh | 3 +++ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/build b/build index e261b3a..11dfec8 100755 --- a/build +++ b/build @@ -175,7 +175,7 @@ function main() { function build_env_image() { echo "Building ENV" - docker image build \ + docker image build \ -t jtreminio/phpenv:latest \ -f Dockerfile-env \ . @@ -191,7 +191,7 @@ function build_php_cli_image() { PHP_MINOR="${2}" echo "Building PHP-CLI ${PHP_MINOR}" - docker image build --no-cache \ + docker image build \ --build-arg PHP_VER=${PHP_MAJOR} \ --build-arg PHP_VER_DOT=${PHP_MINOR} \ -t jtreminio/php-cli:${PHP_MAJOR} \ @@ -210,7 +210,7 @@ function build_php_fpm_image() { PHP_MINOR="${2}" echo "Building PHP-CLI + PHP-FPM ${PHP_MINOR}" - docker image build --no-cache \ + docker image build \ --build-arg PHP_VER=${PHP_MAJOR} \ --build-arg PHP_VER_DOT=${PHP_MINOR} \ -t jtreminio/php:${PHP_MAJOR} \ @@ -229,7 +229,7 @@ function build_apache_image() { PHP_MINOR="${2}" echo "Building PHP ${PHP_MAJOR} + Apache" - docker image build --no-cache \ + docker image build \ --build-arg PHP_VER_DOT=${PHP_MINOR} \ -t jtreminio/php-apache:${PHP_MAJOR} \ -t jtreminio/php-apache:${PHP_MINOR} \ diff --git a/files/nginx/nginx b/files/nginx/nginx index b910c1f..3e47af4 100644 --- a/files/nginx/nginx +++ b/files/nginx/nginx @@ -19,14 +19,6 @@ if [[ ! -f /etc/nginx/sites-enabled/default ]]; then echo Using /etc/nginx/sites-available/${VHOST} ln -s /etc/nginx/sites-available/${VHOST} /etc/nginx/sites-enabled/default - - # passing the CONTAINER_PORT env through perl doesn't work. This is a workaround - sed -i 's/\$[{]nginxport[}]/'${CONTAINER_PORT}'/' /etc/nginx/sites-enabled/default fi -exec nginx -g "daemon off; env PHPFPM_XDEBUG_PORT=${PHPFPM_XDEBUG_PORT}; env CONTAINER_PORT=${CONTAINER_PORT};" - - - - - +exec nginx -g "daemon off; env PHPFPM_XDEBUG_PORT=${PHPFPM_XDEBUG_PORT};" # env CONTAINER_PORT=${CONTAINER_PORT};" tried to add this, but it doesn't work diff --git a/files/php/bin_install_composer.sh b/files/php/bin_install_composer.sh index 04e417c..9936e3f 100644 --- a/files/php/bin_install_composer.sh +++ b/files/php/bin_install_composer.sh @@ -10,3 +10,6 @@ curl -sS https://getcomposer.org/installer | \ php -- --install-dir=/usr/local/bin \ --filename=composer &&\ chown -R www:www /.composer + + +# curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.16 \ No newline at end of file From 8eaabe66480bb9158630346f8a6956bc39bec417 Mon Sep 17 00:00:00 2001 From: emirlike Date: Sat, 22 Jul 2023 20:22:55 -0700 Subject: [PATCH 8/8] improved laravel and wp settings --- files/nginx/nginx.conf | 2 +- files/nginx/vhost/laravel.conf | 3 +++ files/nginx/vhost/wordpress.conf | 35 ++++++++++++++++++++++++++++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/files/nginx/nginx.conf b/files/nginx/nginx.conf index 16b5931..37af294 100644 --- a/files/nginx/nginx.conf +++ b/files/nginx/nginx.conf @@ -32,7 +32,7 @@ http { gzip on; gzip_disable "msie6"; - client_max_body_size 10m; + client_max_body_size 50m; client_body_buffer_size 128k; proxy_redirect off; diff --git a/files/nginx/vhost/laravel.conf b/files/nginx/vhost/laravel.conf index 9814eff..b913cbc 100644 --- a/files/nginx/vhost/laravel.conf +++ b/files/nginx/vhost/laravel.conf @@ -42,4 +42,7 @@ server { location ~ /\.(?!well-known).* { deny all; } + + error_log /var/log/nginx/error.log error; + access_log /var/log/nginx/access.log; } diff --git a/files/nginx/vhost/wordpress.conf b/files/nginx/vhost/wordpress.conf index f600f63..af3da67 100644 --- a/files/nginx/vhost/wordpress.conf +++ b/files/nginx/vhost/wordpress.conf @@ -12,12 +12,23 @@ server { server_name _; root /var/www; index index.php; + location / { - try_files $uri /index.php$is_args$args; + #try_files $uri /index.php$is_args$args; + try_files $uri $uri/ /index.php?$args; } + + rewrite /wp-admin$ $scheme://$host$uri/ permanent; + + # WPLM fix + rewrite ^/en/wp-login.php /wp-login.php break; + rewrite ^/de/wp-login.php /wp-login.php break; + rewrite ^/fr/wp-login.php /wp-login.php break; + rewrite ^/es/wp-login.php /wp-login.php break; + rewrite ^/it/wp-login.php /wp-login.php break; - location ~ ^/index\.php(/|$) { + location ~ \.php(/|$) { set $path_info $fastcgi_path_info; fastcgi_pass $my_fastcgi_pass; @@ -25,7 +36,6 @@ server { fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; } @@ -49,8 +59,25 @@ server { location ~ /\. { deny all; } + + location ~ /\.svn/* { + deny all; + } - location ~* /(?:uploads|files)/.*\.php$ { + location ~ /\.git/* { + deny all; + } + + location /nginx_status { + stub_status on; + access_log off; + } + + location ~ ^/(status|ping)$ { + include /etc/nginx/fastcgi_params; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; + allow 127.0.0.1; deny all; } }