cytopia / devilbox

A modern Docker LAMP stack and MEAN stack for local development
http://devilbox.org
MIT License
4.39k stars 654 forks source link

vhosts page in admin UI is not "seeing" custom config and incorrectly flagging missing htdocs #788

Closed jakeparis closed 3 years ago

jakeparis commented 3 years ago

ISSUE TYPE

Checklist

OS / ENVIRONMENT

  1. Host operating system and version: Mac osx 10.14.6
  2. Docker version: 3.1.0
  3. Docker Compose version: ?
  4. What git commit hash are you on?: cdfb55ec2d061bb20bb6aad1792034d995a855a2

SUMMARY

I've set up a number of projects, some using the default directory of htdocs for files, other using custom apache24.yml file to indicate a different directory to serve files from. The Virtual Hosts page in the UI marks the projects using the default as "OK", the others are marked "ERR". However, the projects are served as expected. It's just a problem in the UI.

STEPS TO REPRODUCE

Create two projects. For project-a add an htdocs directory inside. For project-b add a dist directory, and add .devilbox/apache24.yml file. Only customize the vhost directory section of that file with:

vhost: |
  <VirtualHost __DEFAULT_VHOST__:__PORT__>
      ServerName __VHOST_NAME__
      Protocols  __HTTP_PROTO__

      CustomLog  "__ACCESS_LOG__" combined
      ErrorLog   "__ERROR_LOG__"

  __REDIRECT__
  __SSL__
  __VHOST_DOCROOT__
  __VHOST_RPROXY__
  __PHP_FPM__
  __ALIASES__
  __DENIES__
  __SERVER_STATUS__
      # Custom directives
  __CUSTOM__
  </VirtualHost>

###
### vHost Type (normal or reverse proxy)
###
vhost_type:
  # Normal vHost (-p)
  docroot: |
    # Define the vhost to serve files
    DocumentRoot "/shared/httpd/project-b/dist"
    <Directory "/shared/httpd/project-b/dist">
        DirectoryIndex __INDEX__

        AllowOverride All
        Options All

        RewriteEngine on
        RewriteBase /

        Order allow,deny
        Allow from all
        Require all granted
    </Directory>

  # Reverse Proxy (-r)
  rproxy: |
    # Define the vhost to reverse proxy
    ProxyRequests On
    ProxyPreserveHost On
    ProxyPass __LOCATION__ __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT____LOCATION__
    ProxyPassReverse __LOCATION__ __PROXY_PROTO__://__PROXY_ADDR__:__PROXY_PORT____LOCATION__

EXPECTED BEHAVIOUR

The admin UI will pick up that files are being served from that vhost

ACTUAL BEHAVIOUR

the admin UI only "sees" the files being served out of the default htdocs directory.

OTHER INFORMATION

Start command

$ docker-compose up

Outputs

$ ./check-config.sh

everything is good here
$ docker-compose logs

httpd_1  | [req_distinguished_name]
httpd_1  |
httpd_1  | [ v3_req ]
httpd_1  | basicConstraints = critical, CA:FALSE
httpd_1  | subjectKeyIdentifier = hash
httpd_1  | keyUsage = critical, digitalSignature, keyEncipherment
httpd_1  | authorityKeyIdentifier = keyid:always,issuer:always
httpd_1  | extendedKeyUsage = serverAuth, clientAuth
httpd_1  | subjectAltName=${ALT_NAMES}") -keyout /etc/httpd/cert/mass/campus-map.local.key -subj '/C=DE/ST=Berlin/L=Berlin/O=Devilbox/OU=Devilbox/CN=campus-map.local/emailAddress=admin@campus-map.local' -out /etc/httpd/cert/mass/campus-map.local.csr
httpd_1  | $ openssl x509 -req -sha256 -extensions v3_req -extfile <(echo "[req]
httpd_1  | distinguished_name = req_distinguished_name
httpd_1  | x509_extensions = v3_req
httpd_1  |
httpd_1  | [req_distinguished_name]
httpd_1  |
httpd_1  | [ v3_req ]
httpd_1  | basicConstraints = critical, CA:FALSE
httpd_1  | subjectKeyIdentifier = hash
httpd_1  | keyUsage = critical, digitalSignature, keyEncipherment
httpd_1  | authorityKeyIdentifier = keyid:always,issuer:always
httpd_1  | extendedKeyUsage = serverAuth, clientAuth
httpd_1  | subjectAltName=${ALT_NAMES}") -days 825 -in /etc/httpd/cert/mass/campus-map.local.csr -CA /ca/devilbox-ca.crt -CAkey /ca/devilbox-ca.key -CAcreateserial -out /etc/httpd/cert/mass/campus-map.local.crt
httpd_1  | Certificate:
httpd_1  |     Data:
httpd_1  |         Version: 3 (0x2)
httpd_1  |         Serial Number:
httpd_1  |             52:ac:15:22:ec:20:f1:53:e8:32:08:91:b2:11:0c:d1:a1:36:07:e0
httpd_1  |         Signature Algorithm: sha256WithRSAEncryption
httpd_1  |         Issuer: C = DE, ST = Berlin, L = Berlin, O = Devilbox, OU = Devilbox, CN = Devilbox Root CA, emailAddress = cytopia@devilbox.org, dnQualifier = aYnUy/y58HHPern9yNQWrwexHiA=
httpd_1  |         Validity
httpd_1  |             Not Before: Feb 23 21:41:45 2021 GMT
httpd_1  |             Not After : May 29 21:41:45 2023 GMT
httpd_1  |         Subject: C = DE, ST = Berlin, L = Berlin, O = Devilbox, OU = Devilbox, CN = campus-map.local, emailAddress = admin@campus-map.local
httpd_1  |         Subject Public Key Info:
httpd_1  |             Public Key Algorithm: rsaEncryption
httpd_1  |                 RSA Public-Key: (2048 bit)
httpd_1  |                 Modulus:
httpd_1  |                     00:c2:04:38:21:15:68:69:b9:30:ce:f6:d0:4b:8d:
httpd_1  |                     51:ad:4a:9e:99:76:3e:97:12:df:42:97:11:c1:a9:
httpd_1  |                     40:49:95:94:37:2e:2d:5f:a4:18:f1:f0:d3:fb:ed:
httpd_1  |                     2a:62:f2:f0:43:26:87:b5:95:14:32:66:01:12:73:
httpd_1  |                     65:bf:ff:69:62:b2:45:30:32:0d:8b:56:f2:7b:2a:
httpd_1  |                     8f:c0:67:23:0e:ad:7c:40:17:88:53:07:b6:d7:12:
httpd_1  |                     a6:ad:cc:3c:b2:b1:d6:68:de:9d:5b:bb:7a:88:65:
httpd_1  |                     b4:96:be:04:a6:85:13:54:fa:54:bf:84:76:df:db:
httpd_1  |                     55:46:01:8c:27:e9:d4:6b:53:04:1c:0f:87:1e:1f:
httpd_1  |                     26:9d:52:ae:60:ae:ed:e3:81:02:7e:5a:06:3f:3f:
httpd_1  |                     b5:ef:d7:eb:ae:2c:57:92:88:90:c1:ea:b4:21:b2:
httpd_1  |                     05:4f:05:cb:03:75:f8:05:1b:f7:88:4e:a5:42:a5:
httpd_1  |                     91:3b:d7:16:3b:a2:36:b0:88:9c:12:ee:b3:bc:be:
httpd_1  |                     03:13:d7:41:11:8c:91:a0:02:41:30:ac:ed:28:fb:
httpd_1  |                     08:06:8b:a9:9c:17:47:18:72:d8:f3:a1:8f:64:c3:
httpd_1  |                     c0:fe:2a:12:49:19:93:34:10:25:a7:14:0c:14:03:
httpd_1  |                     b6:67:09:91:78:db:a4:b6:97:97:7f:5f:82:84:70:
httpd_1  |                     0e:4f
httpd_1  |                 Exponent: 65537 (0x10001)
httpd_1  |         X509v3 extensions:
httpd_1  |             X509v3 Basic Constraints: critical
httpd_1  |                 CA:FALSE
httpd_1  |             X509v3 Subject Key Identifier:
httpd_1  |                 25:12:66:E7:1F:6F:F5:A9:B8:A8:41:BB:D8:90:48:D9:CA:EF:59:07
httpd_1  |             X509v3 Key Usage: critical
httpd_1  |                 Digital Signature, Key Encipherment
httpd_1  |             X509v3 Authority Key Identifier:
httpd_1  |                 keyid:69:89:D4:CB:FC:B9:F0:71:CF:7A:B9:FD:C8:D4:16:AF:07:B1:1E:20
httpd_1  |                 DirName:/C=DE/ST=Berlin/L=Berlin/O=Devilbox/OU=Devilbox/CN=Devilbox Root CA/emailAddress=cytopia@devilbox.org/dnQualifier=aYnUy/y58HHPern9yNQWrwexHiA=
httpd_1  |                 serial:0F:7A:E6:B6:63:5E:23:98:08:E3:14:4C:A2:A0:E6:E4:B7:0E:4C:55
httpd_1  |
httpd_1  |             X509v3 Extended Key Usage:
httpd_1  |                 TLS Web Server Authentication, TLS Web Client Authentication
httpd_1  |             X509v3 Subject Alternative Name:
httpd_1  |                 DNS:campus-map.local, DNS:*.campus-map.local
httpd_1  |     Signature Algorithm: sha256WithRSAEncryption
httpd_1  |          45:51:39:83:f6:99:26:58:1c:8e:37:d9:73:5c:de:91:10:66:
httpd_1  |          9a:55:ee:4f:90:2c:60:f3:f1:a5:8b:10:6e:3a:b8:9b:9b:46:
httpd_1  |          8f:e6:c3:32:3c:80:aa:75:3a:55:13:89:9b:16:8d:a1:a9:3f:
httpd_1  |          ea:47:91:12:0e:15:3c:3f:2a:fe:77:fa:b9:15:4b:2c:af:a8:
httpd_1  |          e1:55:75:56:23:0c:55:10:f4:91:2b:92:3b:ec:5a:48:92:fa:
httpd_1  |          ae:29:eb:e3:09:94:29:4d:7f:bf:fd:51:9d:45:90:5a:38:e7:
httpd_1  |          8b:00:af:83:2f:b1:2f:e7:b0:44:48:42:6e:02:88:57:60:8b:
httpd_1  |          8e:5a:29:df:03:e5:e1:29:9b:f9:a8:08:36:45:08:a8:35:36:
httpd_1  |          86:1d:f1:b4:d0:de:75:79:71:24:c8:9a:5d:06:1e:b9:3d:f5:
httpd_1  |          8d:79:d8:72:0a:78:3d:e4:70:81:23:64:e7:ed:68:bc:6c:55:
httpd_1  |          58:f3:1b:89:bc:c1:05:98:65:96:46:9f:88:bc:57:76:ef:85:
httpd_1  |          47:91:3f:a9:de:1a:57:81:eb:e4:f0:38:24:99:8c:c2:3b:09:
httpd_1  |          76:1a:d4:2c:17:ee:95:1d:87:ca:8f:db:87:92:10:a6:a5:6d:
httpd_1  |          26:2f:52:c8:88:60:c1:b6:89:6b:f9:d7:6b:df:79:32:04:5a:
httpd_1  |          36:25:4c:f4
httpd_1  | /etc/httpd/cert/mass/campus-map.local.crt: OK
httpd_1  | $ vhost-gen -p "/shared/httpd/campus-map" -n "campus-map" -c /etc/vhost-gen/mass.yml -o "/shared/httpd/campus-map/.devilbox/" -s -v -m both
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Loading configuration file        (-c): /etc/vhost-gen/mass.yml
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Loading vhost template (global)   (-t): /etc/vhost-gen/templates/apache24.yml
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Loading vhost template (override) (-o): /shared/httpd/campus-map/.devilbox/apache24.yml
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Creating vhost type: https and http (both)
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Using vhost name: campus-map.local
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Log setting: dir -> True
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Log setting: Not specified
httpd_1  | vhost-gen: [INFO]  (2021-02-23 16:41:45): Vhost config written to: /etc/httpd/vhost.d/campus-map.conf
httpd_1  | watcherd: [2021-02-23 16:41:45] [OK]  ADD: succeeded: /shared/httpd/campus-map
httpd_1  | $ openssl req -newkey rsa:2048 -sha256 -nodes -extensions v3_req -config <(echo "[req]
httpd_1  | distinguished_name = req_distinguished_name
httpd_1  | x509_extensions = v3_req
cytopia commented 3 years ago
  • [x] .env file is attached

Where can I see the .env file?

jakeparis commented 3 years ago

Sorry about that, here you are.

###
###  ---------------------------------------------------
###  D E V I L B O X   R U N - T I M E   S E T T I N G S
###  ---------------------------------------------------
###
###  All the following settings are applied during
###  $ docker-compose up
###
###  No need to rebuild any docker images!
###
###  IMPORTANT:
###  ----------
###  When changing any values ensure to stop, rm and restart:
###  $ docker-compose stop
###  $ docker-compose rm -f
###  $ docker-compose up
###
###  NOTE:
###  -----
###  For you own custom variables, scroll to the bottom
###

# The following line will disable any shellcheck warnings throughout this file
# shellcheck disable=SC2034,SC2125

###
### Show all executed commands in each
### docker image during docker-compose up?
###
### 0: Quiet
### 1: Verbose
### 2: More verbose
DEBUG_COMPOSE_ENTRYPOINT=2

###
### Log to file or Docker logs.
###
### Logging to file means log files are available under log/
### on your host operating system.
### Logging to Docker logs means log files are streamed to
### stdout and stderr.
###
### 1: Log to Docker logs
### 0: Log to file
###
DOCKER_LOGS=0

###
### Relative or absolute path to the devilbox repository.
### (Used as a prefix for all mount paths)
### There is no need to change this.
###
### The only exception is for OSX users wanting to use NFS
### mounts instead of Filesystem mounts due to degraded performance
### on OSX.
###
### Note: When changing this variable you must re-create the container.
###       Simply remove it, it will be auto-created during the next start:
###
### $ docker-compose rm -f
###
DEVILBOX_PATH=.

###
### At what IP address should the docker services listen
### on the Host computer?
###
### The specified default should be fine for Linux and OSX (127.0.0.1:).
### If you are on windows, you will probably have to change
### it to the IP address of the docker machine.
###
### a.) Leave blank, to listen on all interfaces (no trailing colon ':')
###    LOCAL_LISTEN_ADDR=
### b.) If an IP is specified, note the trailing colon ':'
###    LOCAL_LISTEN_ADDR=127.0.0.1:
###
LOCAL_LISTEN_ADDR=127.0.0.1:

###
### This is the domain suffix your projects will be made available
### with mass-virtual-hosting.
### It is also required for the internal DNS server to be setup.
###
### Note: Only ALPHA ([a-zA-Z]+) characters are supported.
###
### Example:
###   TLD_SUFFIX=loc
### Makes your project available under xxxx.loc
###
### Example:
###   TLD_SUFFIX=local
### Makes your project available under xxxx.local
###
TLD_SUFFIX=local

###
### Optional DNS configuration
### Allows you to add extra DNS records (above the wildcard entry)
### Useful if your host computer run other Docker services that you want to connect to or reach
### from within the Devilbox network by a custom hostname.
###
### Format:
### -------
### Resolve any custom defined hostname to an IP address (useable inside container and host os)
###     EXTRA_HOSTS=<hostname>=<ip>[,<hostname>=<ip>]
###
### Resolve any custom defined hostname to whatever IP address a CNAME resolves to
### (Useable inside the container and host OS).
### Note: CNAME must be resolvable by Google DNS
###     EXTRA_HOSTS=<hostname>=<CNAME>[,<hostname>=<CNAME>]
###
### Examples:
### ---------
### EXTRA_HOSTS=hostname.loc=1.2.3.4
### EXTRA_HOSTS=host.loc=1.2.3.4,host.example.org=3.4.5.6
EXTRA_HOSTS=

###
### Set your user id and group id
###
### This should be changed to the value of your local
### users uid and gid
###
### Type `id` on the terminal to find out your values
###
NEW_UID=267164627
NEW_GID=701479588

###
### Timezone for PHP Docker container (system and php.ini)
###
TIMEZONE=EST

################################################################################
###
### INTRANET SETTINGS
###
################################################################################

###
### TLD_SUFFIX domains are checked if they are set in the
### host computer /etc/hosts or available via attached DNS server.
### Timeout is done on vhosts.php (intranet) via ajax calls.
### In order to keep performance, set this to a low value.
### DNS checks might not succeed in time on slow machines.
### If DNS is valid, but timeout is expired, set this to a higher value.
###
### DNS_CHECK_TIMEOUT value is how many seconds to time out
### Default is to timeout after 1 second (DNS_CHECK_TIMEOUT=1)
###
DNS_CHECK_TIMEOUT=1

###
### Devilbox UI SSL Certificate generation
###
### When using SSL each certificate requires names for which it is responsible:
### Common Name as well as alternative names.
###
### Specify comma separated hostnames below by which you want to access the Devilbox.
### Those hostnames will be included in the SSL certificate for the Devilbox intranet.
### This has nothing to do for SSL certificates for projects, it is just for the intranet
### itself.
###
DEVILBOX_UI_SSL_CN=localhost,*.localhost,devilbox,*.devilbox,httpd

###
### Devilbox UI Password protection enable/disable (1/0)
###
### Set DEVILBOX_UI_PROTECT to 1 in order to password protect the
### intranet.
###
### Example:
###   DEVILBOX_UI_PROTECT=1
###   DEVILBOX_UI_PROTECT=0
###
DEVILBOX_UI_PROTECT=0

###
### Devilbox UI Password
###
### When DEVILBOX_UI_PROTECT=1, use the following password
### to log in. The password can always be changed.
### When changing the password, make sure to restart your
### PHP container.
###
### Example:
###   DEVILBOX_UI_PASSWORD=my-very-secure-password
###   DEVILBOX_UI_PASSWORD=Some pass with spaces
###
### The default username is 'devilbox'
###
DEVILBOX_UI_PASSWORD=password

###
### Enable the Devilbox Intranet?
###
### Example:
###   DEVILBOX_UI_ENABLE=1
###   DEVILBOX_UI_ENABLE=0
###
DEVILBOX_UI_ENABLE=1

###
### Automatically be logged in into phpMyAdmin
###
### Example:
###   DEVILBOX_VENDOR_PHPMYADMIN_AUTOLOGIN=1
###   DEVILBOX_VENDOR_PHPMYADMIN_AUTOLOGIN=0
###
DEVILBOX_VENDOR_PHPMYADMIN_AUTOLOGIN=1

###
### Automatically be logged in into phpPgAdmin
###
### Example:
###   DEVILBOX_VENDOR_PHPPGADMIN_AUTOLOGIN=1
###   DEVILBOX_VENDOR_PHPPGADMIN_AUTOLOGIN=0
###
DEVILBOX_VENDOR_PHPPGADMIN_AUTOLOGIN=1

################################################################################
###
### 1. Choose Images (Version)
###
################################################################################

###
### You can choose any combination of httpd, mysql, postgresql or php.
### Each of them are fully compatible between one another.
###

###
### 1.1 Choose PHP Server Image
###
### Note: PHP 5.2 is not officially supported. Intranet won't work (due to lack of namespace support).
###       PHP 5.2 only works with Apache 2.4, Nginx stable and Nginx mainline.
###       Use at your own risk.
###
#PHP_SERVER=5.2
#PHP_SERVER=5.3
#PHP_SERVER=5.4
#PHP_SERVER=5.5
#PHP_SERVER=5.6
#PHP_SERVER=7.0
#PHP_SERVER=7.1
#PHP_SERVER=7.2
#PHP_SERVER=7.3
PHP_SERVER=7.4
# PHP_SERVER=8.0
# PHP_SERVER=8.1

###
### 1.2 Choose HTTPD Server Image
###
#HTTPD_SERVER=apache-2.2
HTTPD_SERVER=apache-2.4
# HTTPD_SERVER=nginx-stable
#HTTPD_SERVER=nginx-mainline

###
### 1.3 Choose MySQL Server Image
###
#MYSQL_SERVER=mysql-5.5
#MYSQL_SERVER=mysql-5.6
#MYSQL_SERVER=mysql-5.7
#MYSQL_SERVER=mysql-8.0
#MYSQL_SERVER=mariadb-5.5
#MYSQL_SERVER=mariadb-10.0
#MYSQL_SERVER=mariadb-10.1
#MYSQL_SERVER=mariadb-10.2
#MYSQL_SERVER=mariadb-10.3
#MYSQL_SERVER=mariadb-10.4
MYSQL_SERVER=mariadb-10.5
#MYSQL_SERVER=percona-5.5
#MYSQL_SERVER=percona-5.6
#MYSQL_SERVER=percona-5.7
#MYSQL_SERVER=percona-8.0

###
### 1.4 Choose PostgreSQL Server Image
###
### IMPORTANT: Alpine based images might cause issues on Docker Toolbox or OSX
###            https://github.com/docker/toolbox/issues/510
###
#PGSQL_SERVER=9.0
#PGSQL_SERVER=9.1
#PGSQL_SERVER=9.2
#PGSQL_SERVER=9.2-alpine
#PGSQL_SERVER=9.3
#PGSQL_SERVER=9.3-alpine
#PGSQL_SERVER=9.4
#PGSQL_SERVER=9.4-alpine
#PGSQL_SERVER=9.5
#PGSQL_SERVER=9.5-alpine
#PGSQL_SERVER=9.6
#PGSQL_SERVER=9.6-alpine
#PGSQL_SERVER=10.0
#PGSQL_SERVER=10.0-alpine
#PGSQL_SERVER=10.1
#PGSQL_SERVER=10.1-alpine
#PGSQL_SERVER=10.2
#PGSQL_SERVER=10.2-alpine
#PGSQL_SERVER=10.3
#PGSQL_SERVER=10.3-alpine
#PGSQL_SERVER=10.4
#PGSQL_SERVER=10.4-alpine
#PGSQL_SERVER=10.5
#PGSQL_SERVER=10.5-alpine
#PGSQL_SERVER=10.6
#PGSQL_SERVER=10.6-alpine
#PGSQL_SERVER=10.7
#PGSQL_SERVER=10.7-alpine
#PGSQL_SERVER=10.8
#PGSQL_SERVER=10.8-alpine
#PGSQL_SERVER=10.9
#PGSQL_SERVER=10.9-alpine
#PGSQL_SERVER=10.10
#PGSQL_SERVER=10.10-alpine
#PGSQL_SERVER=10.11
#PGSQL_SERVER=10.11-alpine
#PGSQL_SERVER=11.0
#PGSQL_SERVER=11.0-alpine
#PGSQL_SERVER=11.1
#PGSQL_SERVER=11.1-alpine
#PGSQL_SERVER=11.2
#PGSQL_SERVER=11.2-alpine
#PGSQL_SERVER=11.3
#PGSQL_SERVER=11.3-alpine
#PGSQL_SERVER=11.4
#PGSQL_SERVER=11.4-alpine
#PGSQL_SERVER=11.5
#PGSQL_SERVER=11.5-alpine
#PGSQL_SERVER=11.6
#PGSQL_SERVER=11.6-alpine
#PGSQL_SERVER=11.7
#PGSQL_SERVER=11.7-alpine
#PGSQL_SERVER=11.8
#PGSQL_SERVER=11.8-alpine
#PGSQL_SERVER=11.9
#PGSQL_SERVER=11.9-alpine
#PGSQL_SERVER=12.0
#PGSQL_SERVER=12.0-alpine
#PGSQL_SERVER=12.1
#PGSQL_SERVER=12.1-alpine
#PGSQL_SERVER=12.2
#PGSQL_SERVER=12.2-alpine
#PGSQL_SERVER=12.3
#PGSQL_SERVER=12.3-alpine
PGSQL_SERVER=12.4
#PGSQL_SERVER=12.4-alpine
#PGSQL_SERVER=13.0
#PGSQL_SERVER=13.0-alpine
#PGSQL_SERVER=latest
#PGSQL_SERVER=alpine

###
### 1.5 Choose Redis Server Image
###
### IMPORTANT: Alpine based images might cause issues on Docker Toolbox or OSX
###            https://github.com/docker/toolbox/issues/510
###
#REDIS_SERVER=2.8
#REDIS_SERVER=3.0
#REDIS_SERVER=3.0-alpine
#REDIS_SERVER=3.2
#REDIS_SERVER=3.2-alpine
#REDIS_SERVER=4.0
#REDIS_SERVER=4.0-alpine
#REDIS_SERVER=5.0
#REDIS_SERVER=5.0-alpine
REDIS_SERVER=6.0
#REDIS_SERVER=6.0-alpine
#REDIS_SERVER=latest
#REDIS_SERVER=alpine

###
### 1.6 Choose Memcached Server Image
###
### IMPORTANT: Alpine based images might cause issues on Docker Toolbox or OSX
###            https://github.com/docker/toolbox/issues/510
###
#MEMCD_SERVER=1.4
#MEMCD_SERVER=1.4-alpine
#MEMCD_SERVER=1.5
#MEMCD_SERVER=1.5-alpine
MEMCD_SERVER=1.6
#MEMCD_SERVER=1.6-alpine
#MEMCD_SERVER=latest
#MEMCD_SERVER=alpine

###
### 1.7 Choose Mongo Server Image
###
#MONGO_SERVER=2.8
#MONGO_SERVER=3.0
#MONGO_SERVER=3.2
#MONGO_SERVER=3.4
#MONGO_SERVER=3.6
#MONGO_SERVER=4.0
#MONGO_SERVER=4.2
MONGO_SERVER=4.4
#MONGO_SERVER=latest

################################################################################
###
### 2. Host Mounts (Your computer)
###
################################################################################

###
### Global mount options
###
### Note: When adding custom mount options, ensure to start with a
###       leading ',' (comma), as those options are prepended to already
###       existing mount options.
###
### Note: If no mount options are specified, leave this variable empty
###       and do not add a leading ',' (comma).
###
### MOUNT_OPTIONS=,cached
### MOUNT_OPTIONS=
###
### Example: Allow to share mounts accross container with SELINUX enabled
###
### MOUNT_OPTIONS=,z
###
MOUNT_OPTIONS=,cached

###
### Local filesystem path to www projects.
###
### Note: When changing this variable you must re-create the container.
###       Simply remove it, it will be auto-created during the next start:
###
### $ docker-compose rm -f
###
HOST_PATH_HTTPD_DATADIR=~/www

###
### Local filesystem path to where your backups are stored
###
### Note: When changing this variable you must re-create the container.
###       Simply remove it, it will be auto-created during the next start:
###
### $ docker-compose rm -f
###
HOST_PATH_BACKUPDIR=./backups

###
### The path on your host OS of the ssh directory to be mounted into the
### PHP container into /home/devilbox/.ssh.
###
### IMPORTANT: The path is mounted read-only to ensure you cannot accidentally
##             delete anything inside the php container.
###
HOST_PATH_SSH_DIR=~/.ssh

################################################################################
###
### 3. PHP Docker Settings
###
################################################################################

###
### Enable certain PHP modules which are not enabled by default
###
### Currently the only modules that can be enabled are 'ioncube' and 'blackfire'
### Also ensure to disable xdebug when using any of the above:
### https://xdebug.org/docs/install#compat
###
### PHP_MODULES_ENABLE=ioncube, blackfire
###
PHP_MODULES_ENABLE=imagick

###
### Disable any PHP modules that you don't require
###
### Specify a comma separated list without spaces of modules to disable
###
### PHP_MODULES_DISABLE=xdebug,imagick,swoole
###
PHP_MODULES_DISABLE=oci8,PDO_OCI,pdo_sqlsrv,sqlsrv,rdkafka,swoole

###
### Postfix settings for email catch-all
###
### When set to '1' postfix is normally started and made available. However you still need
### to configure it to your needs yourself. For that you can use the autostart scripts
### and define a couple of 'postconf -e name=value' commands.
###
### When set to '2' (email catch-all), no mail will leave the Devilbox. It is automatically
### internally routed the the devilbox mail account and you can see each sent mail
### in the bundled intranet: https://localhost/mail.php
###
### Values:
### 0: Disable postfix (do not start it)
### 1: Enable/Start postfix
### 2: Enable/Start postfix and enable email catch-all
###
PHP_MAIL_CATCH_ALL=2

###
### Configure everything else about PHP in
### * cfg/php-ini-X.X/*.ini
### * cfg/php-fpm-X.X/*.conf

################################################################################
###
### 4. HTTPD Docker Settings
###
################################################################################

###
### Expose HTTPD Port to Host
###
HOST_PORT_HTTPD=80
HOST_PORT_HTTPD_SSL=443

###
### SSL (HTTP/HTTPS) settings for automated vhost generation
###
### By default each project will have two vhosts (one for HTTP and one for HTTPS).
### You can control the SSL settings for your projects via the below stated values.
###
### This is internally achieved via the '-m' argument of https://github.com/devilbox/vhost-gen
###
### Values:
###   * both:  Serve HTTP and HTTPS for all projects
###   * redir: HTTP always redirects to HTTPS
###   * ssl:   Only serve HTTPS
###   * plain: Only serve HTTP
###
HTTPD_VHOST_SSL_TYPE=both

###
### Document Root Subdirectory
###
### In your project directory, which subfolder should
### serve your files?
###
### When changing this value, restart the devilbox.
###
HTTPD_DOCROOT_DIR=htdocs

###
### Per vHost Config Subdirectory
###
### In your project directory, which subfolder should
### hold apache, nginx templates for a customized vhost?
###
### When changing this value, restart the devilbox.
###
HTTPD_TEMPLATE_DIR=.devilbox

###
### Webserver timeout (in seconds) to upstream PHP-FPM server
###
### This value should be greater than PHP's max_execution_time,
### otherwise the php script could still run and the webserver will
### simply drop the connection before getting an answer by PHP.
###
HTTPD_TIMEOUT_TO_PHP_FPM=180

###
### NGINX ONLY
###
### Set worker_processes and worker_connections
###
### https://nginx.org/en/docs/ngx_core_module.html#worker_processes
### https://nginx.org/en/docs/ngx_core_module.html#worker_connections
###
HTTPD_NGINX_WORKER_PROCESSES=auto
HTTPD_NGINX_WORKER_CONNECTIONS=1024

################################################################################
###
### 5. MySQL Docker Settings
###
################################################################################

###
### MySQL root user password
###
### The password is required for the initial creation of the MySQL database
### as well as the Devilbox intranet to display schema and configuration settings.
###
### If you change your MySQL root user password via mysql cli, phpMyAdmin or other tools
### after the database has been created, ensure to adjust the value here accordingly as well.
###
### If you only change this value here after the database has been created,
### the MySQL root user password will not actually be changed and the Devilbox intranet
### won't be able to connect to the MySQL service.
###
MYSQL_ROOT_PASSWORD=

###
### Expose MySQL Port to Host
###
HOST_PORT_MYSQL=3306

################################################################################
###
### 6. PostgreSQL Docker Settings
###
################################################################################

###
### PostgreSQL 'root' user name (usually postgres)
###
PGSQL_ROOT_USER=postgres

###
### PostgreSQL 'root' user password
###
### If you want to set a password, ensure to remove 'trust' from
### PGSQL_HOST_AUTH_METHOD below
###
PGSQL_ROOT_PASSWORD=

###
### In order to not use a password for PostgreSQL, keep this value at 'trust'
###
PGSQL_HOST_AUTH_METHOD=trust

###
### Expose PostgreSQL Port to Host
###
HOST_PORT_PGSQL=5432

################################################################################
###
### 7. Redis Docker Settings
###
################################################################################

###
### Expose Redis Port to Host
###
HOST_PORT_REDIS=6379

###
### Custom startup arguments
###
### Apply custom startup arguments to redis
###
### Example: Password protection
###   Add password protection to the Redis server by specifying it should
###   require a password.
###   Note: Do not add quotes or spaces to the password
###
###   REDIS_ARGS=--requirepass my-redis-root-password
###
### Example: Verbosity
###
###   REDIS_ARGS=--loglevel verbose
###
REDIS_ARGS=
#REDIS_ARGS=--loglevel verbose --requirepass my-redis-root-password

################################################################################
###
### 8. Memcached Docker Settings
###
################################################################################

###
### Expose Memcached Port to Host
###
HOST_PORT_MEMCD=11211

################################################################################
###
### 9. MongoDB Docker Settings
###
################################################################################

###
### Expose MongoDB Port to Host
###
HOST_PORT_MONGO=27017

################################################################################
###
### 10. Bind Docker Settings
###
################################################################################

###
### Expose Bind Port to Host
###
# HOST_PORT_BIND=1053
HOST_PORT_BIND=53

###
### Add comma separated DNS server from which you want to receive DNS
### You can also add DNS servers from your LAN (if any are available)
###
BIND_DNS_RESOLVER=8.8.8.8,8.8.4.4

###
### Validate DNSSEC
###
### Values:
###  no:    DNSSEC validation is disabled
###  yes:   DNSSEC validation is enabled, but a trust anchor must be manually configured.
###  auto:  DNSSEC validation is enabled, and a default trust anchor for root zone is used.
###
BIND_DNSSEC_VALIDATE=no

###
### Bind timing options (time in seconds)
###
### Leave empty for defaults.
### Only change when you know what you are doing.
###
BIND_TTL_TIME=
BIND_REFRESH_TIME=
BIND_RETRY_TIME=
BIND_EXPIRY_TIME=
BIND_MAX_CACHE_TIME=

###
### Show DNS Queries in Docker logs output?
###
### 1: Yes
### 0: No
BIND_LOG_DNS_QUERIES=0

################################################################################
###
### 11. Custom variables
###
################################################################################

###
### Any variable defined in this file will be available
### as environment variables to your PHP/HHV Docker container.
###
### This might be useful to set application environment and retrieve
### them via: <?php getenv('MY_APPLICATION_ENV'); ?>
###

###
### Example:
### <?php echo getenv('Foo'); ?> would produce: 'some value'
###
#Foo=some value

HOST_PORT_NGROK=4040
# Share project1.loca over the internet
NGROK_HTTP_TUNNELS=webservices.local:httpd:80
# No license token specified
NGROK_AUTHTOKEN=
cytopia commented 3 years ago

I just did that:

 tree project-a/ -a
project-a/
├── .devilbox
│   └── apache24.yml
└── htdocs

apache24.yml contents copied from what you've specified. Works totally fine.

/vhosts.php

Screenshot 2021-05-21 15-41-27  selection

/info_vhostgen.php?name=project-a

Screenshot 2021-05-21 15-41-42  selection

I would assume you might have added the file to a wrong path.

jakeparis commented 3 years ago

In your screenshot, it shows the problem:

That should be an "OK" in the valid column, with the url pointing to the docroot for that vhost.

cytopia commented 3 years ago

The above was just an example and I did not add a DNS record. Here you go:

Screenshot 2021-05-21 15-59-47  selection

jakeparis commented 3 years ago

Ok, I'm sorry, my initial point was not perfectly clear. In your example, you have an htdocs directory, that's why it's working. My issue is that I am trying to serve the docs out of a different directory, in my example, the dist directory.

The apache24.yml example from my first post is mean to be for that vhost.

cytopia commented 3 years ago

Just symlink the dist/ directory to htdocs:

https://devilbox.readthedocs.io/en/latest/vhost-gen/example-add-subdomains.html?highlight=symlink#directory-structure

jakeparis commented 3 years ago

Ok, that works for the vhost page to "see" the custom docroot, even without the .devilbox/apache24.yml file. But also, so does creating an empty htdocs directory and using the apache24.yml.

In both cases, just the presence of the htdocs is enough for the vhost to show "OK", even though the docroot is actually something else entirely. This feels a little hacky, though. Is it possible for the vhosts list to recognize the root as specified in the apache24.yml file, without having to also create an htdocs directory, just to fake it out?

cytopia commented 3 years ago

No, vhosts are served by default from the htdocs directory. If this is present, then it is served. It is up to you what you put inside. If you have your data in a different directory and add a htdocs directory, then only the htdocs directory is served.

If you symlink the htdocs directory to someplace else, then the content of that place is served.

This is the agreed protocol of how it works. ;-)

jakeparis commented 3 years ago

Thank you for your time and help!