I'm trying to build apache image , with apache config which will set up a Virtual host and eventually will Redirect all non-static requests to Unicorn. But while building the image it's failing with the error.Action '-D FOREGROUND' failed
i followed a tutorial for this purpose and added the virtual host below in my apache2.conf file
<VirtualHost *:80>
ServerName test.example.com
DocumentRoot /var/www/app/public
RewriteEngine On
# Redirect all non-static requests to unicorn
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L]
RewriteCond %{DOCUMENT_ROOT}/public/$0 -f
RewriteRule ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf)$ /public/$0 [L]
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:3000
</Proxy>
ProxyPass / balancer://unicornservers/
ProxyPassReverse / balancer://unicornservers/
ProxyPreserveHost on
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>
And docker file for apache image
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y apache2
RUN apt-get install -y apache2-utils
EXPOSE 80
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
ENV APACHE_SERVER_NAME localhost
ENV RAILS_ROOT /var/www/app
WORKDIR $RAILS_ROOT
COPY public public/
RUN a2enmod proxy
RUN a2enmod proxy_balancer
RUN a2enmod proxy_http
RUN a2enmod rewrite
RUN a2enmod ssl
RUN a2enmod headers
RUN a2enmod proxy_html
COPY config/containers/web/apache2.conf /etc/apache2
COPY config/containers/web/ssl /etc/apache2/ssl/
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]