Просмотр исходного кода

Adds example on setting a docroot with Apache

Addresses comments made here: https://github.com/docker-library/php/issues/246
Jason McCallister 8 лет назад
Родитель
Сommit
b6d3320ff9
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      php/content.md

+ 13 - 0
php/content.md

@@ -147,6 +147,19 @@ RUN curl -fsSL 'https://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.
 	&& rm -r /tmp/xcache
 ```
 
+#### Changing the docroot
+
+Some applications may wish to change the default docroot from Apache. The following Dockerfile demonstrates how you can use an environment variable to make that change:
+
+```
+FROM php:7.1-apache
+
+ENV APACHE_DOCUMENT_ROOT /path/to/new/root
+
+RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
+RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
+```
+
 ### Without a `Dockerfile`
 
 If you don't want to include a `Dockerfile` in your project, it is sufficient to do the following: