Search code examples
ddev

Why do I see nginx headers when ddev is configured to use apache?


I updated ddev to version 1.3.0 and ran ddev config. After that I changed the configuration from nginx-fpm to apache-fpm. After starting ddev and checked the HTTP headers, there is nginx/1.15.3 used. Is there something else to do, to get Apache working?

My config.yaml:

APIVersion: v1.3.0
name: example
type: typo3
docroot: public
php_version: "7.2"
webserver_type: apache-fpm
router_http_port: "8080"
router_https_port: "8443"
xdebug_enabled: true
additional_hostnames: []
additional_fqdns: []
provider: default
hooks:
  post-start:
  - exec: composer install -d /var/www/html
  - exec: ../vendor/bin/typo3cms cache:flush
  - exec: ../vendor/bin/typo3cms database:updateschema
  - exec: yarn --cwd typo3conf/ext/theme/Resources/Private install

Solution

  • That is such a good question! I know because I already got stumped by it myself when writing tests.

    The answer is: Apache runs in the web container but when you use the http://*.ddev.local URL, it goes through ddev-router, which is an nginx reverse proxy, and that's why you see the nginx headers. But rest assured you are using Apache. You can confirm that these ways:

    • ddev ssh and ps -ef to see what's running
    • Hit the 127.0.0.1 URL reported by ddev start and ddev describe. That URL goes directly to the web container, for example http://127.0.0.1:33221 - You'll see the apache headers on that one.

    Your question is so good - Could you please edit the title to something like "Why do I see nginx headers when ddev is configured to use apache?" - I think other people will find it that way.

    $ curl -I http://127.0.0.1:33224
    HTTP/1.1 200 OK
    Date: Fri, 12 Oct 2018 02:18:26 GMT
    Server: Apache/2.4.25 (Debian)
    Cache-Control: must-revalidate, no-cache, private
    X-Drupal-Dynamic-Cache: HIT
    X-UA-Compatible: IE=edge
    Content-language: en
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    Expires: Sun, 19 Nov 1978 05:00:00 GMT
    Vary:
    X-Generator: Drupal 8 (https://www.drupal.org)
    X-Drupal-Cache: MISS
    Content-Type: text/html; charset=UTF-8