From 1ad6de7e4ca1e341d1c21cb5f7b540fe0c6b697c Mon Sep 17 00:00:00 2001 From: cytopia Date: Tue, 26 Sep 2017 16:51:49 +0200 Subject: [PATCH] REL-0.12 Attach new nginx Docker container --- .../bin/apache-2.2/fix-virtual-docroot.php | 3 - .../bin/apache-2.4/fix-virtual-docroot.php | 3 - .devilbox/etc/apache-2.2/00-defaults.conf | 23 ------ .devilbox/etc/apache-2.2/00-php-fpm.conf | 6 -- .../etc/apache-2.2/01-vhost-default.conf | 40 ---------- .devilbox/etc/apache-2.2/02-vhost-mass.conf | 44 ----------- .devilbox/etc/apache-2.4/00-defaults.conf | 23 ------ .devilbox/etc/apache-2.4/00-php-fpm.conf | 17 ---- .../etc/apache-2.4/01-vhost-default.conf | 42 ---------- .devilbox/etc/apache-2.4/02-vhost-mass.conf | 45 ----------- .devilbox/etc/nginx-mainline/00-defaults.conf | 8 -- .../etc/nginx-mainline/01-vhost-default.conf | 77 ------------------- .../etc/nginx-mainline/02-vhost-mass.conf | 67 ---------------- .devilbox/etc/nginx-stable/00-defaults.conf | 8 -- .../etc/nginx-stable/01-vhost-default.conf | 75 ------------------ .devilbox/etc/nginx-stable/02-vhost-mass.conf | 67 ---------------- docker-compose.yml | 61 ++++++++------- 17 files changed, 30 insertions(+), 579 deletions(-) delete mode 100755 .devilbox/bin/apache-2.2/fix-virtual-docroot.php delete mode 100755 .devilbox/bin/apache-2.4/fix-virtual-docroot.php delete mode 100644 .devilbox/etc/apache-2.2/00-defaults.conf delete mode 100644 .devilbox/etc/apache-2.2/00-php-fpm.conf delete mode 100644 .devilbox/etc/apache-2.2/01-vhost-default.conf delete mode 100644 .devilbox/etc/apache-2.2/02-vhost-mass.conf delete mode 100644 .devilbox/etc/apache-2.4/00-defaults.conf delete mode 100644 .devilbox/etc/apache-2.4/00-php-fpm.conf delete mode 100644 .devilbox/etc/apache-2.4/01-vhost-default.conf delete mode 100644 .devilbox/etc/apache-2.4/02-vhost-mass.conf delete mode 100644 .devilbox/etc/nginx-mainline/00-defaults.conf delete mode 100644 .devilbox/etc/nginx-mainline/01-vhost-default.conf delete mode 100644 .devilbox/etc/nginx-mainline/02-vhost-mass.conf delete mode 100644 .devilbox/etc/nginx-stable/00-defaults.conf delete mode 100644 .devilbox/etc/nginx-stable/01-vhost-default.conf delete mode 100644 .devilbox/etc/nginx-stable/02-vhost-mass.conf diff --git a/.devilbox/bin/apache-2.2/fix-virtual-docroot.php b/.devilbox/bin/apache-2.2/fix-virtual-docroot.php deleted file mode 100755 index e2b6fc13..00000000 --- a/.devilbox/bin/apache-2.2/fix-virtual-docroot.php +++ /dev/null @@ -1,3 +0,0 @@ - - ServerName localhost - ServerAlias 127.0.0.1 - ServerAlias 172.16.238.* - ServerAlias httpd - - ServerAdmin root@localhost - - ErrorLog /var/log/apache-2.2/devilbox-error.log - CustomLog /var/log/apache-2.2/devilbox-access.log combined - - DirectoryIndex index.php index.html - - DocumentRoot "/var/www/default/htdocs" - - DirectoryIndex index.php index.html - - AllowOverride All - Options All - - RewriteEngine on - RewriteBase / - - Order allow,deny - Allow from all - - - - SetHandler server-status - - Order allow,deny - Allow from all - - - diff --git a/.devilbox/etc/apache-2.2/02-vhost-mass.conf b/.devilbox/etc/apache-2.2/02-vhost-mass.conf deleted file mode 100644 index 45b6eb12..00000000 --- a/.devilbox/etc/apache-2.2/02-vhost-mass.conf +++ /dev/null @@ -1,44 +0,0 @@ -## -## Default Mass Virtual Host -## - - - - # Get the server name from the Host: header - UseCanonicalName Off - - ServerName localhost - ServerAlias *.* - ServerAdmin root@localhost - - # Required for DNS checking - SetEnvIf Origin "http(s)?://(domain1.org|localhost|127.0.0.1|httpd)$" AccessControlAllowOrigin=$0$1 - Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin - - LogFormat "%V;%h;%l;%u;%t;\"%r\";%>s;%b;\"%{Referer}i\";\"%{User-agent}i\"" vcommon - CustomLog "/var/log/apache-2.2/projects-access.log" vcommon - ErrorLog /var/log/apache-2.2/projects-error.log - - DirectoryIndex index.php index.html - - # When using VirtualDocumentRoot the PHP Env var DOCUMENT_ROOT - # is not filled, so we need to do that manually with a custom script. - VirtualDocumentRoot /shared/httpd/%-2+/htdocs/ - php_admin_value auto_prepend_file /opt/bin/fix-virtual-docroot.php - - # Devilbox API endpoint - Alias "/devilbox-api" "/var/www/default/api/devilbox-api" - - - DirectoryIndex index.php index.html - - AllowOverride All - Options All - - RewriteEngine on - RewriteBase / - - Order allow,deny - Allow from all - - diff --git a/.devilbox/etc/apache-2.4/00-defaults.conf b/.devilbox/etc/apache-2.4/00-defaults.conf deleted file mode 100644 index 3b05f01c..00000000 --- a/.devilbox/etc/apache-2.4/00-defaults.conf +++ /dev/null @@ -1,23 +0,0 @@ -CustomLog "/var/log/apache-2.4/access_log" combined -ErrorLog "/var/log/apache-2.4/error_log" -LogLevel warn - -AddDefaultCharset UTF-8 - -# No DNS -HostnameLookups Off -# -Timeout 60 -KeepAlive On -KeepAliveTimeout 10 -MaxKeepAliveRequests 100 -# -# -EnableMMAP Off -EnableSendfile Off -# -# -# -# -XSendFile On -XSendFilePath /shared/httpd diff --git a/.devilbox/etc/apache-2.4/00-php-fpm.conf b/.devilbox/etc/apache-2.4/00-php-fpm.conf deleted file mode 100644 index 6d0f57fa..00000000 --- a/.devilbox/etc/apache-2.4/00-php-fpm.conf +++ /dev/null @@ -1,17 +0,0 @@ -#### PHP-FPM config #### - -# enablereuse -# Defining a worker will improve performance -# And in this case, re-use the worker (dependent on support from the fcgi application) -# If you have enough idle workers, this would only improve the performance marginally -# -# enablereuse requires Apache 2.4.11 or later -# - - Require all granted - # Pick one of the following approaches - # Use the standard TCP socket - SetHandler "proxy:fcgi://php:9000" - # If your version of httpd is 2.4.9 or newer (or has the back-ported feature), you can use the unix domain socket - #SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/:9000" - diff --git a/.devilbox/etc/apache-2.4/01-vhost-default.conf b/.devilbox/etc/apache-2.4/01-vhost-default.conf deleted file mode 100644 index 0fe252bb..00000000 --- a/.devilbox/etc/apache-2.4/01-vhost-default.conf +++ /dev/null @@ -1,42 +0,0 @@ -## -## Default Host for http://localhost -## - - - - ServerName localhost - ServerAlias 127.0.0.1 - ServerAlias 172.16.238.* - ServerAlias httpd - - ServerAdmin root@localhost - - ErrorLog /var/log/apache-2.4/devilbox-error.log - CustomLog /var/log/apache-2.4/devilbox-access.log combined - - DirectoryIndex index.php index.html - - DocumentRoot "/var/www/default/htdocs" - - DirectoryIndex index.php index.html - - AllowOverride All - Options All - - RewriteEngine on - RewriteBase / - - Order allow,deny - Allow from all - Require all granted - - - - SetHandler server-status - - Order allow,deny - Allow from all - Require all granted - - - diff --git a/.devilbox/etc/apache-2.4/02-vhost-mass.conf b/.devilbox/etc/apache-2.4/02-vhost-mass.conf deleted file mode 100644 index 873393f7..00000000 --- a/.devilbox/etc/apache-2.4/02-vhost-mass.conf +++ /dev/null @@ -1,45 +0,0 @@ -## -## Default Mass Virtual Host -## - - - - # Get the server name from the Host: header - UseCanonicalName Off - - ServerName localhost - ServerAlias *.* - ServerAdmin root@localhost - - # Required for DNS checking - SetEnvIf Origin "http(s)?://(domain1.org|localhost|127.0.0.1|httpd)$" AccessControlAllowOrigin=$0$1 - Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin - - LogFormat "%V;%h;%l;%u;%t;\"%r\";%>s;%b;\"%{Referer}i\";\"%{User-agent}i\"" vcommon - CustomLog "/var/log/apache-2.4/projects-access.log" vcommon - ErrorLog /var/log/apache-2.4/projects-error.log - - DirectoryIndex index.php index.html - - # When using VirtualDocumentRoot the PHP Env var DOCUMENT_ROOT - # is not filled, so we need to do that manually with a custom script. - VirtualDocumentRoot /shared/httpd/%-2+/htdocs/ - php_admin_value auto_prepend_file /opt/bin/fix-virtual-docroot.php - - # Devilbox API endpoint - Alias "/devilbox-api" "/var/www/default/api/devilbox-api" - - - DirectoryIndex index.php index.html - - AllowOverride All - Options All - - RewriteEngine on - RewriteBase / - - Order allow,deny - Allow from all - Require all granted - - diff --git a/.devilbox/etc/nginx-mainline/00-defaults.conf b/.devilbox/etc/nginx-mainline/00-defaults.conf deleted file mode 100644 index 0dc048fe..00000000 --- a/.devilbox/etc/nginx-mainline/00-defaults.conf +++ /dev/null @@ -1,8 +0,0 @@ -charset utf-8; - -send_timeout 60; -keepalive_timeout 10; - -sendfile off; -tcp_nopush on; -tcp_nodelay on; diff --git a/.devilbox/etc/nginx-mainline/01-vhost-default.conf b/.devilbox/etc/nginx-mainline/01-vhost-default.conf deleted file mode 100644 index ce3f5c36..00000000 --- a/.devilbox/etc/nginx-mainline/01-vhost-default.conf +++ /dev/null @@ -1,77 +0,0 @@ -## -## Default Host for http://localhost -## - -server { - listen 80 default_server; - server_name _; - server_name localhost; - server_name 127.0.0.1; - server_name httpd; - server_name 172.16.238.*; - - # Root directive - root /var/www/default/htdocs; - index index.php; - - access_log /var/log/nginx-mainline/devilbox-access.log main; - error_log /var/log/nginx-mainline/devilbox-error.log warn; - - # Devilbox httpd info/status - location /devilbox-httpd-status { - stub_status on; - access_log off; - } - - # Devilbox API endpoint - location ~ /devilbox-api/ { - root /var/www/default/api/; - index status.json; - - # Allow cross-domain requests to this domain - # Used to validate if client DNS is setup correctly - if ( $http_origin ~* (https?://(localhost|127\.0\.0\.1|httpd)$) ) { - add_header "Access-Control-Allow-Origin" "$http_origin"; - } - } - - # Front-controller pattern as recommended by the nginx docs - location / { - try_files $uri $uri/ /index.php; - } - - # PHP FPM - location ~ \.php?$ { - # PHP.INI: - # --------------------------- - # // Find this: - # cgi.fix_pathinfo=1 - # // Replace with: - # cgi.fix_pathinfo=0 - - try_files $uri = 404; - include fastcgi_params; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_split_path_info ^(.+\.php)(.*)$; - - #### FPM Server - fastcgi_pass php:9000; - - fastcgi_index index.php; - fastcgi_intercept_errors on; - } - - - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - location ~ /\.ht { - deny all; - } - - # disallow access to git configs path - location ~ /\.git { - deny all; - } -} diff --git a/.devilbox/etc/nginx-mainline/02-vhost-mass.conf b/.devilbox/etc/nginx-mainline/02-vhost-mass.conf deleted file mode 100644 index 090ac399..00000000 --- a/.devilbox/etc/nginx-mainline/02-vhost-mass.conf +++ /dev/null @@ -1,67 +0,0 @@ -## -## Default Mass Virtual Host -## - -server { - listen 80; - server_name ~^(?.+)\.[a-zA-Z]+$; - - # Root directive - root /shared/httpd/$domain/htdocs/; - index index.php; - - access_log /var/log/nginx-mainline/projects-access.log main; - error_log /var/log/nginx-mainline/projects-error.log warn; - - # Devilbox API endpoint - location ~ /devilbox-api/ { - root /var/www/default/api/; - index status.json; - access_log off; - - # Allow cross-domain requests to this domain - # Used to validate if client DNS is setup correctly - if ( $http_origin ~* (https?://(localhost|127\.0\.0\.1|httpd)$) ) { - add_header "Access-Control-Allow-Origin" "$http_origin"; - } - } - - # Front-controller pattern as recommended by the nginx docs - location / { - try_files $uri $uri/ /index.php$is_args$args; - } - - # PHP FPM - location ~ \.php?$ { - - # PHP.INI: - # --------------------------- - # // Find this: - # cgi.fix_pathinfo=1 - # // Replace with: - # cgi.fix_pathinfo=0 - - try_files $uri = 404; - include fastcgi_params; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_split_path_info ^(.+\.php)(.*)$; - - #### SOCKET - fastcgi_pass php:9000; - - fastcgi_index index.php; - fastcgi_intercept_errors on; - } - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - location ~ /\.ht { - deny all; - } - - # disallow access to git configs path - location ~ /\.git { - deny all; - } -} diff --git a/.devilbox/etc/nginx-stable/00-defaults.conf b/.devilbox/etc/nginx-stable/00-defaults.conf deleted file mode 100644 index 0dc048fe..00000000 --- a/.devilbox/etc/nginx-stable/00-defaults.conf +++ /dev/null @@ -1,8 +0,0 @@ -charset utf-8; - -send_timeout 60; -keepalive_timeout 10; - -sendfile off; -tcp_nopush on; -tcp_nodelay on; diff --git a/.devilbox/etc/nginx-stable/01-vhost-default.conf b/.devilbox/etc/nginx-stable/01-vhost-default.conf deleted file mode 100644 index 933f2110..00000000 --- a/.devilbox/etc/nginx-stable/01-vhost-default.conf +++ /dev/null @@ -1,75 +0,0 @@ -## -## Default Host for http://localhost -## - -server { - listen 80 default_server; - server_name _; - server_name localhost; - server_name 127.0.0.1; - server_name httpd; - server_name 172.16.238.*; - - # Root directive - root /var/www/default/htdocs; - index index.php; - - access_log /var/log/nginx-stable/devilbox-access.log main; - error_log /var/log/nginx-stable/devilbox-error.log warn; - - # Devilbox httpd info/status - location /devilbox-httpd-status { - stub_status on; - access_log off; - } - - # Devilbox API endpoint - location ~ /devilbox-api/ { - root /var/www/default/api/; - index status.json; - - # Allow cross-domain requests to this domain - # Used to validate if client DNS is setup correctly - if ( $http_origin ~* (https?://(localhost|127\.0\.0\.1|httpd)$) ) { - add_header "Access-Control-Allow-Origin" "$http_origin"; - } - } - - # Front-controller pattern as recommended by the nginx docs - location / { - try_files $uri $uri/ /index.php; - } - - # PHP FPM - location ~ \.php?$ { - # PHP.INI: - # --------------------------- - # // Find this: - # cgi.fix_pathinfo=1 - # // Replace with: - # cgi.fix_pathinfo=0 - - try_files $uri = 404; - include fastcgi_params; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_split_path_info ^(.+\.php)(.*)$; - - #### FPM Server - fastcgi_pass php:9000; - - fastcgi_index index.php; - fastcgi_intercept_errors on; - } - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - location ~ /\.ht { - deny all; - } - - # disallow access to git configs path - location ~ /\.git { - deny all; - } -} diff --git a/.devilbox/etc/nginx-stable/02-vhost-mass.conf b/.devilbox/etc/nginx-stable/02-vhost-mass.conf deleted file mode 100644 index e5720fb8..00000000 --- a/.devilbox/etc/nginx-stable/02-vhost-mass.conf +++ /dev/null @@ -1,67 +0,0 @@ -## -## Default Mass Virtual Host -## - -server { - listen 80; - server_name ~^(?.+)\.[a-zA-Z]+$; - - # Root directive - root /shared/httpd/$domain/htdocs/; - index index.php; - - access_log /var/log/nginx-stable/projects-access.log main; - error_log /var/log/nginx-stable/projects-error.log warn; - - # Devilbox API endpoint - location ~ /devilbox-api/ { - root /var/www/default/api/; - index status.json; - access_log off; - - # Allow cross-domain requests to this domain - # Used to validate if client DNS is setup correctly - if ( $http_origin ~* (https?://(localhost|127\.0\.0\.1|httpd)$) ) { - add_header "Access-Control-Allow-Origin" "$http_origin"; - } - } - - # Front-controller pattern as recommended by the nginx docs - location / { - try_files $uri $uri/ /index.php$is_args$args; - } - - # PHP FPM - location ~ \.php?$ { - - # PHP.INI: - # --------------------------- - # // Find this: - # cgi.fix_pathinfo=1 - # // Replace with: - # cgi.fix_pathinfo=0 - - try_files $uri = 404; - include fastcgi_params; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_split_path_info ^(.+\.php)(.*)$; - - #### SOCKET - fastcgi_pass php:9000; - - fastcgi_index index.php; - fastcgi_intercept_errors on; - } - - # deny access to .htaccess files, if Apache's document root - # concurs with nginx's one - location ~ /\.ht { - deny all; - } - - # disallow access to git configs path - location ~ /\.git { - deny all; - } -} diff --git a/docker-compose.yml b/docker-compose.yml index da32693b..8ad8b695 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -171,9 +171,11 @@ services: # HOST-DIRECTORY : DOCKER-DIRECTORY # Mount custom intranet - # (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf) - ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro + # Mount custom mass virtual hosting + - ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd + # Mount logs - ${DEVILBOX_PATH}/log/${PHP_SERVER}:/var/log/php @@ -194,10 +196,6 @@ services: # Mount devilbox user-defined bash config - ${DEVILBOX_PATH}/bash:/etc/bashrc-devilbox.d - # Mount custom mass virtual hosting - # (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf) - - ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd - depends_on: - bind @@ -205,8 +203,8 @@ services: # HTTPD # ---------------------------------------- httpd: - image: cytopia/${HTTPD_SERVER:-nginx-stable}:latest - #image: cytopia/${HTTPD_SERVER:-nginx-stable}:0.9 + #image: cytopia/${HTTPD_SERVER:-nginx-stable}:latest + image: cytopia/${HTTPD_SERVER:-nginx-stable}:release-0.10 restart: always # Manually build via `docker-compose build` @@ -219,13 +217,33 @@ services: ## ## Debug? ## - - DEBUG_COMPOSE_ENTRYPOINT + - DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT} + - DEBUG_RUNTIME=${DEBUG_COMPOSE_ENTRYPOINT} ## ## Adjust timezone ## - TIMEZONE + ## + ## UserID and GroupID + ## + - NEW_UID + - NEW_GID + + ## + ## Disable default vhost? + ## + - VHOST_MAIN_DISABLE=${DEVILBOX_UI_DISABLE} + + ## + ## Enable Mass Vhosts + ## + - MASS_VHOST_ENABLE=1 + - MASS_VHOST_TLD=.${TLD_SUFFIX} + - MASS_VHOST_DIR_SUFFIX=${HTTPD_DOCROOT_DIR} + - MASS_VHOST_TPL=${HTTPD_TEMPLATE_DIR} + ## ## PHP-FPM Remote Server ## @@ -233,12 +251,6 @@ services: - PHP_FPM_SERVER_ADDR=php - PHP_FPM_SERVER_PORT=9000 - ## Tell the webserver to look into this directory - ## for additional configuration files. - ## - ## @see volumes:: - ./etc/${HTTPD_SERVER}:/etc/${HTTPD_SERVER} - - CUSTOM_HTTPD_CONF_DIR=/etc/${HTTPD_SERVER} - ports: # ---- Format: ---- # [HOST-ADDR : ] HOST-PORT : DOCKER-PORT @@ -252,27 +264,14 @@ services: # ---- Format: ---- # HOST-DIRECTORY : DOCKER-DIRECTORY - # Custom scripts/binaries required for httpd server vhost - # configuration to work. - # (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf) - - ${DEVILBOX_PATH}/.devilbox/bin/${HTTPD_SERVER}:/opt/bin:ro - - # Mount user-defined httpd configuration files - # @see environment::CUSTOM_HTTPD_CONF_DIR for how this - # is added in httpd server - - ${DEVILBOX_PATH}/.devilbox/etc/${HTTPD_SERVER}:/etc/${HTTPD_SERVER}:ro - # Mount custom intranet - # (configured in /etc/${HTTPD_SERVER}/01-vhost-default.conf) - ${DEVILBOX_PATH}/.devilbox/www:/var/www/default:ro - # Mount user-defined httpd log - # @see ./etc/${HTTPD_SERVER}/*.conf for log defines - - ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/${HTTPD_SERVER} - # Mount custom mass virtual hosting - # (configured in /etc/${HTTPD_SERVER}/02-vhost-mass.conf) - - ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd:ro + - ${HOST_PATH_HTTPD_DATADIR}:/shared/httpd + + # Mount logs + - ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/${HTTPD_SERVER} depends_on: - bind