Commit 0e2d92ee authored by Seb's avatar Seb

MAJ double vhost

parent 0bf970a9
......@@ -4,7 +4,9 @@ MAINTAINER Kal <kal@periscopemail.com
ENV PHP_HOST php-fpm
ENV PHP_PORT 9000
ENV PHP_PATH /var/www/html
ENV PHP_PATH2 /var/www/html
ENV DISALLOW_ROBOTS true
ENV DISALLOW_VHOST2 true
ENV HT_PASSORWD ""
ENV HT_LOGIN anonymous
ENV PROXY_TIMEOUT 60
......@@ -25,8 +27,11 @@ RUN echo "Include conf/performance.conf" >> /usr/local/apache2/conf/httpd.conf
# Include our vhost with php-fpm
COPY config/vhost.conf /usr/local/apache2/vhost.conf
COPY config/vhost2.conf /usr/local/apache2/vhost2.conf
RUN echo "ServerName localhost" >> /usr/local/apache2/conf/httpd.conf \
&& echo "Include conf/extra/vhost.conf" >> /usr/local/apache2/conf/httpd.conf
&& echo "Include conf/extra/vhost.conf" >> /usr/local/apache2/conf/httpd.conf \
&& echo "Include conf/extra/vhost2.conf" >> /usr/local/apache2/conf/httpd.conf
# Generate robots.txt file to disallow search engine accesses
RUN { \
......
......@@ -15,16 +15,42 @@ sed -i \
-e "s|{PROXY_TIMEOUT}|$PROXY_TIMEOUT|g" \
/usr/local/apache2/conf/extra/vhost.conf
if [ $DISALLOW_VHOST2 = "false" ]; then
cp /usr/local/apache2/vhost2.conf /usr/local/apache2/conf/extra/vhost2.conf
sed -i \
-e "s|{PHP_HOST}|$PHP_HOST|g" \
-e "s|{PHP_PORT}|$PHP_PORT|g" \
-e "s|{PHP_PATH2}|$PHP_PATH2|g" \
-e "s|{PROXY_TIMEOUT}|$PROXY_TIMEOUT|g" \
/usr/local/apache2/conf/extra/vhost2.conf
fi
if [ $DISALLOW_ROBOTS = "true" ]; then
sed -i "s|#R||g" /usr/local/apache2/conf/extra/vhost.conf
if [ $DISALLOW_VHOST2 = "false" ]; then
sed -i "s|#R||g" /usr/local/apache2/conf/extra/vhost2.conf
fi
fi
if (! [ -z "$HT_PASSWORD" ]) then
htpasswd -b -c /usr/local/apache2/.htpasswd $HT_LOGIN $HT_PASSWORD
sed -i \
-e "s|#A||g" \
-e "s|Require all granted||g" \
/usr/local/apache2/conf/extra/vhost.conf
if [ $DISALLOW_VHOST2 = "false" ]; then
sed -i \
-e "s|#A||g" \
-e "s|Require all granted||g" \
/usr/local/apache2/conf/extra/vhost2.conf
fi
fi
exec "$@"
<VirtualHost *:80>
DocumentRoot {PHP_PATH2}
<Directory {PHP_PATH2}/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
#A Require local
#A Require ip 172.16.0.0/12
#A AuthName "Restricted area"
#A AuthType Basic
#A AuthUserFile "/usr/local/apache2/.htpasswd"
#A Require valid-user
</Directory>
<LocationMatch "^/(.*\.php(/.*)?)$">
ProxyPass fcgi://{PHP_HOST}:{PHP_PORT}{PHP_PATH2}/$1
</LocationMatch>
ProxyTimeout {PROXY_TIMEOUT}
TimeOut {PROXY_TIMEOUT}
# Directory indexes
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
#R <Location "/robots.txt">
#R SetHandler None
#R Require all granted
#R </Location>
#R Alias /robots.txt /usr/local/apache2/robots.txt
</VirtualHost>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment