docker run -v /path/to/app:/var/www/site -p `boot2docker ip`:8080:80 -d name
Last active
August 29, 2015 14:07
-
-
Save armstrongnate/5592558fee1543c827e0 to your computer and use it in GitHub Desktop.
PHP and Apache on Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
DocumentRoot /var/www/site | |
<Directory /var/www/site> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Order deny,allow | |
Allow from all | |
</Directory> | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:latest | |
MAINTAINER Your Name <yourEmail@email.com> | |
RUN apt-get update | |
RUN apt-get -y upgrade | |
# Install apache, PHP, and supplimentary programs. curl and lynx-cur are for debugging the container. | |
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install apache2 libapache2-mod-php5 php5-mysql php5-gd php-pear php-apc php5-curl curl lynx-cur | |
# Enable apache mods. | |
RUN a2enmod php5 | |
RUN a2enmod rewrite | |
# Update the PHP.ini file, enable <? ?> tags and quieten logging. | |
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php5/apache2/php.ini | |
RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php5/apache2/php.ini | |
# Manually set up the apache environment variables | |
ENV APACHE_RUN_USER www-data | |
ENV APACHE_RUN_GROUP www-data | |
ENV APACHE_LOG_DIR /var/log/apache2 | |
ENV APACHE_LOCK_DIR /var/lock/apache2 | |
ENV APACHE_PID_FILE /var/run/apache2.pid | |
EXPOSE 80 | |
# Update the default apache site with the config we created. | |
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf | |
# Copy site into place | |
Add . /var/www/site | |
# By default, simply start apache. | |
CMD /usr/sbin/apache2ctl -D FOREGROUND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment