webdevops / TYPO3-docker-boilerplate

:stew: TYPO3 Docker Boilerplate project (NGINX, Apache HTTPd, PHP-FPM, MySQL, Solr, Elasticsearch, Redis, FTP)
https://webdevops.io/projects/typo3-docker-boilerplate/
MIT License
233 stars 91 forks source link

Apache ServerName configuration is faulty #115

Closed raphaelstolt closed 8 years ago

raphaelstolt commented 8 years ago

I used the 5.0.0 release from a Windows box and noticed that the Apache ServerName configuration contains some sort of hash instead of the default docker.vm value.

mblaschke commented 8 years ago

Can you provide more informations? Please attach the apache configuration.

raphaelstolt commented 8 years ago

The Apache config /opt/docker/etc/httpd/global.conf on the app container looks like the following:

# Settings
TimeOut      1000
ServerName   "f66ccf4ce501"

DirectoryIndex index.php
DocumentRoot "/app/web/"

<Directory "/app/web/">
  Options Indexes FollowSymLinks
  AllowOverride All

  <IfVersion < 2.4>
      Allow from all
  </IfVersion>
  <IfVersion >= 2.4>
      Require all granted
  </IfVersion>
</Directory>

LogFormat "[httpd:access] %V:%p %h %l %u %t \"%r\" %>s bytesIn:%I bytesOut:%O reqTime:%T" dockerlog
CustomLog /proc/self/fd/1 dockerlog
ErrorLog  /proc/self/fd/2

#######################################
# Faster error documents
#######################################
<Location ~ "(\.jpeg|\.jpg|\.gif|\.png|\.ico|\.js|\.css|\.map|\.json|\.xml|robots\.txt)$">
  ErrorDocument 400 "400 Bad Request"
  ErrorDocument 401 "401 Unauthorized"
  ErrorDocument 403 "403 Forbidden"
  ErrorDocument 404 "404 Not Found"
  ErrorDocument 405 "405 Method Not Allowed"

  ErrorDocument 500 "500 Internal Server Error"
  ErrorDocument 501 "501 Not Implemented"
  ErrorDocument 502 "502 Bad Gateway"
  ErrorDocument 503 "503 Service Unavailable"
</Location>

From the Docker log it also seems that the ServerName value is not set correctly, would expect to see the value configured in application.development.yml there.

changed: [localhost] => (item=[{u'variable': u'SERVERNAME', u'value': u'f66ccf4ce501'}, u'/opt/docker/etc/httpd/global.conf'])
ok: [localhost] => (item=[{u'variable': u'SERVERNAME', u'value': u'f66ccf4ce501'}, u'/opt/docker/etc/httpd/main.conf'])
ok: [localhost] => (item=[{u'variable': u'SERVERNAME', u'value': u'f66ccf4ce501'}, u'/opt/docker/etc/httpd/php.conf'])
ok: [localhost] => (item=[{u'variable': u'SERVERNAME', u'value': u'f66ccf4ce501'}, u'/opt/docker/etc/httpd/vhost.common.conf'])
ok: [localhost] => (item=[{u'variable': u'SERVERNAME', u'value': u'f66ccf4ce501'}, u'/opt/docker/etc/httpd/vhost.conf'])
ok: [localhost] => (item=[{u'variable': u'SERVERNAME', u'value': u'f66ccf4ce501'}, u'/opt/docker/etc/httpd/vhost.ssl.conf'])

Though just noticed that in /opt/docker/etc/httpd/vhost.conf the value is correctly expanded.

raphaelstolt commented 8 years ago

So why is this closed w/o comment?

mblaschke commented 8 years ago

This issue is not fixed? I thought that this issue is fixed.

mblaschke commented 8 years ago

The Apache ServerName is the global host name of the Apache server and will be set to the hostname of the current docker Container.

There are vhosts with your which uses the *.vm domains which also overwrite the ServerName inside.

mblaschke commented 8 years ago

There is now a modular apache configuration available by using /opt/docker/etc/httpd/conf.d for global configuration and /opt/docker/etc/httpd/vhost.common.d for vhost configuration.

For more informations see http://dockerfile.readthedocs.io/en/latest/content/DockerImages/dockerfiles/apache.html