Cleanup
This commit is contained in:
parent
f1a7f016f4
commit
1bc984aedc
28
Dockerfile
28
Dockerfile
|
|
@ -42,40 +42,48 @@ RUN apk add --no-cache \
|
||||||
shadow
|
shadow
|
||||||
|
|
||||||
# Configure to use php fpm and don't use /var/www to store everything (modules and logs)
|
# Configure to use php fpm and don't use /var/www to store everything (modules and logs)
|
||||||
RUN sed -i 's/LoadModule mpm_prefork_module/#LoadModule mpm_prefork_module/g' /etc/apache2/httpd.conf && \
|
RUN \
|
||||||
|
# Disable mpm_prefork
|
||||||
|
sed -i 's/LoadModule mpm_prefork_module/#LoadModule mpm_prefork_module/g' /etc/apache2/httpd.conf && \
|
||||||
|
# Enable mpm_event
|
||||||
sed -i 's/#LoadModule mpm_event_module/LoadModule mpm_event_module/g' /etc/apache2/httpd.conf && \
|
sed -i 's/#LoadModule mpm_event_module/LoadModule mpm_event_module/g' /etc/apache2/httpd.conf && \
|
||||||
|
# Enable rewrite mod
|
||||||
sed -i 's/#LoadModule rewrite_module/LoadModule rewrite_module/g' /etc/apache2/httpd.conf && \
|
sed -i 's/#LoadModule rewrite_module/LoadModule rewrite_module/g' /etc/apache2/httpd.conf && \
|
||||||
# Remove useless module bundled with proxy
|
# Remove useless module bundled with proxy
|
||||||
sed -i 's/LoadModule lbmethod/#LoadModule lbmethod/g' /etc/apache2/conf.d/proxy.conf && \
|
sed -i 's/LoadModule lbmethod/#LoadModule lbmethod/g' /etc/apache2/conf.d/proxy.conf && \
|
||||||
# Enable deflate
|
# Enable deflate mod
|
||||||
sed -i 's/#LoadModule deflate_module/LoadModule deflate_module/g' /etc/apache2/httpd.conf && \
|
sed -i 's/#LoadModule deflate_module/LoadModule deflate_module/g' /etc/apache2/httpd.conf && \
|
||||||
|
# Enable expires mod
|
||||||
sed -i 's/#LoadModule expires_module/LoadModule expires_module/g' /etc/apache2/httpd.conf && \
|
sed -i 's/#LoadModule expires_module/LoadModule expires_module/g' /etc/apache2/httpd.conf && \
|
||||||
|
# Enable session mod
|
||||||
sed -i 's/#LoadModule session_module/LoadModule session_module/g' /etc/apache2/httpd.conf && \
|
sed -i 's/#LoadModule session_module/LoadModule session_module/g' /etc/apache2/httpd.conf && \
|
||||||
# Disable some configs
|
# Do not expose PHP version to the world
|
||||||
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php7/php.ini && \
|
|
||||||
sed -i 's/expose_php = On/expose_php = Off/g' /etc/php7/php.ini && \
|
sed -i 's/expose_php = On/expose_php = Off/g' /etc/php7/php.ini && \
|
||||||
# Change DocumentRoot
|
# Disable APC - it has been replaced by APCu and opcache in PHP7 - https://pecl.php.net/package/apc
|
||||||
|
echo 'apc.enabled = Off' >> /etc/php7/php.ini && \
|
||||||
|
# Change DocumentRoot to /var/www
|
||||||
sed -i 's/var\/www\/localhost\/htdocs/var\/www\/html/g' /etc/apache2/httpd.conf && \
|
sed -i 's/var\/www\/localhost\/htdocs/var\/www\/html/g' /etc/apache2/httpd.conf && \
|
||||||
# Change ServerRoot
|
# Change ServerRoot to /usr/local/apache
|
||||||
sed -i 's/ServerRoot \/var\/www/ServerRoot \/usr\/local\/apache/g' /etc/apache2/httpd.conf && \
|
sed -i 's/ServerRoot \/var\/www/ServerRoot \/usr\/local\/apache/g' /etc/apache2/httpd.conf && \
|
||||||
# Make sure PHP-FPM executes as apache user
|
# Make sure PHP-FPM executes as apache user
|
||||||
sed -i 's/user = nobody/user = apache/g' /etc/php7/php-fpm.d/www.conf && \
|
sed -i 's/user = nobody/user = apache/g' /etc/php7/php-fpm.d/www.conf && \
|
||||||
sed -i 's/group = nobody/group = apache/g' /etc/php7/php-fpm.d/www.conf && \
|
sed -i 's/group = nobody/group = apache/g' /etc/php7/php-fpm.d/www.conf && \
|
||||||
# Prepare env
|
# Prepare Apache log dir
|
||||||
mkdir -p /var/log/apache2 && \
|
mkdir -p /var/log/apache2 && \
|
||||||
# Clean base directory and create required ones
|
# Clean base directory
|
||||||
rm -rf /var/www/* && \
|
rm -rf /var/www/* && \
|
||||||
# Apache configs in one place
|
# Apache configs in one place
|
||||||
mkdir -p /usr/local/apache && \
|
mkdir -p /usr/local/apache && \
|
||||||
ln -s /usr/lib/apache2 /usr/local/apache/modules && \
|
ln -s /usr/lib/apache2 /usr/local/apache/modules && \
|
||||||
ln -s /var/log/apache2 /usr/local/apache/logs
|
ln -s /var/log/apache2 /usr/local/apache/logs
|
||||||
|
|
||||||
# PHP-FPM config
|
# PHP-FPM vhost config
|
||||||
COPY vhost.conf /etc/apache2/conf.d/vhost.conf
|
COPY vhost.conf /etc/apache2/conf.d/vhost.conf
|
||||||
|
|
||||||
# Make sure apache can read&right to logs and docroot
|
# Make sure apache can read&right to logs and docroot
|
||||||
RUN chown -R apache:apache /var/log/apache2 /var/www
|
RUN chown -R apache:apache /var/log/apache2 /var/www
|
||||||
### Execute as Apache user ###
|
|
||||||
|
### Continue execution as Apache user ###
|
||||||
USER apache
|
USER apache
|
||||||
|
|
||||||
# Define Grav specific version of Grav or use latest stable
|
# Define Grav specific version of Grav or use latest stable
|
||||||
|
|
|
||||||
5
run.sh
5
run.sh
|
|
@ -1,10 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Make sure apache can read&right to /var/www
|
|
||||||
chown -R apache:apache /var/log/apache2 /var/www
|
|
||||||
|
|
||||||
# Create cron job for Grav maintenance scripts
|
# Create cron job for Grav maintenance scripts
|
||||||
(crontab -l; echo "* * * * * cd /var/www/html;/usr/local/bin/php bin/grav scheduler 1>> /dev/null 2>&1") | crontab -
|
exec (crontab -l; echo "* * * * * cd /var/www/html;/usr/local/bin/php bin/grav scheduler 1>> /dev/null 2>&1") | crontab -
|
||||||
|
|
||||||
# Start PHP-FPM and Apache
|
# Start PHP-FPM and Apache
|
||||||
exec /usr/sbin/httpd -D FOREGROUND -f /etc/apache2/httpd.conf &
|
exec /usr/sbin/httpd -D FOREGROUND -f /etc/apache2/httpd.conf &
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue