From 49452089e4d3b26d1da96f46b90974f4732d220b Mon Sep 17 00:00:00 2001 From: startxfr Date: Sat, 6 Dec 2014 00:27:16 +0100 Subject: adding httpd config file when building apache image. --- Services/apache/Dockerfile | 7 +++++-- Services/apache/README.md | 3 ++- Services/apache/html/index.html | 2 +- Services/apache/httpd.conf | 8 ++++++++ Services/apache/sx/httpd.sh | 3 ++- 5 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Services/apache/httpd.conf diff --git a/Services/apache/Dockerfile b/Services/apache/Dockerfile index 316834c..10a6e1f 100644 --- a/Services/apache/Dockerfile +++ b/Services/apache/Dockerfile @@ -1,6 +1,7 @@ FROM startx/fedora MAINTAINER Christophe LARUE +USER root # Install packages and set up httpd RUN yum -y install httpd \ && yum clean all \ @@ -8,12 +9,14 @@ RUN yum -y install httpd \ && mkdir -p /var/log/httpd # Copy startx toolkit COPY sx/* /sx/ +COPY httpd.conf /etc/httpd/conf.d/sx.conf # Copy html content COPY html/* /var/www/html/ RUN chmod ug+rx /sx/httpd* \ - && chmod ug+r /var/www/html/*\ - && chmod ug+r /var/www/html/* + && chmod ug+r /var/www/html/* \ + && chown -R apache:apache /var/www/html /var/log/httpd EXPOSE 80 EXPOSE 443 +VOLUME ["/var/www/html", "/var/log/httpd"] CMD ["/sx/httpd_run.sh"] \ No newline at end of file diff --git a/Services/apache/README.md b/Services/apache/README.md index 3638549..ae07abb 100644 --- a/Services/apache/README.md +++ b/Services/apache/README.md @@ -13,11 +13,12 @@ Copy sources in your docker host cd startx-docker-images; git clone https://github.com/startxfr/docker-images.git . +Change configuration and personalize your base image. you can change file httpd.conf if you want to add some config into http server + Build the container docker build -t sv-apache Services/apache/ - ### Running local image docker run -d -p 80:80 --name="apache" sv-apache diff --git a/Services/apache/html/index.html b/Services/apache/html/index.html index 5025e94..9c72bb2 100644 --- a/Services/apache/html/index.html +++ b/Services/apache/html/index.html @@ -49,7 +49,7 @@

STARTX Webserver

-

Actif

+

Online

diff --git a/Services/apache/httpd.conf b/Services/apache/httpd.conf new file mode 100644 index 0000000..8eab200 --- /dev/null +++ b/Services/apache/httpd.conf @@ -0,0 +1,8 @@ +# +# This file will be copied into /etc/httpd/conf.d/sx.conf and loaded when httpd start +# +ServerAdmin cl@startx.fr + + AllowOverride All + DirectoryIndex index.html home.html + diff --git a/Services/apache/sx/httpd.sh b/Services/apache/sx/httpd.sh index a632dff..04f08b4 100644 --- a/Services/apache/sx/httpd.sh +++ b/Services/apache/sx/httpd.sh @@ -11,6 +11,7 @@ function begin_config { # End configuration process just before starting daemon function end_config { + stop_server echo "=> End httpd configuration ..." } @@ -34,7 +35,7 @@ function stop_server { # the running shell function start_daemon { echo "=> Starting httpd daemon ..." - exec /usr/sbin/apachectl + exec /usr/sbin/apachectl -D FOREGROUND } -- cgit v1.2.3