Apache fixes

This commit is contained in:
Andrei Condurachi 2020-11-23 21:12:04 +02:00
parent 2ac0c5b542
commit 8cf52b486d
2 changed files with 12 additions and 16 deletions

View File

@ -121,9 +121,7 @@ COPY vhost.conf /etc/apache2/conf.d/vhost.conf
# https://gitlab.alpinelinux.org/alpine/aports/-/issues/9279
RUN sed -i 's/SYSLOGD_OPTS="-Z"/SYSLOGD_OPTS="-t"/g' /etc/conf.d/syslog
# Start Apache by default
RUN rc-update add httpd default
# default PHP-FPM by default
# Start PHP-FPM by default
RUN rc-update add php-fpm7 default
# Create cron job for Grav maintenance scripts
@ -134,6 +132,14 @@ RUN (crontab -l; echo "") | crontab -
# Provide container inside image for data persistence
VOLUME ["/var/www"]
COPY run.sh /run.sh
RUN chmod u+x /run.sh
CMD ["/run.sh"]
# Allow apache user login
RUN sed -i "s/apache(.*)\/sbin\/nologin/apache\\1\/bin\/ash/g" /etc/passwd
# Make sure apache can read&right to docroot
RUN chown -R apache:apache /var/www
# Make sure apache can read&right to logs
RUN chown -R apache:apache /var/log/apache2
# Allow Apache to create pid
RUN chown -R apache:apache /run/apache2
# Start Apache
CMD ["/usr/sbin/httpd", "-D"]

10
run.sh
View File

@ -1,10 +0,0 @@
#!/bin/sh
# Allow apache user login
sed -i 's/apache(.*)\/sbin\/nologin/apache\\1\/bin\/ash/g' /etc/passwd
# Make sure apache can read&right to docroot
chown -R apache:apache /var/www
# Make sure apache can read&right to logs
chown -R apache:apache /var/log/apache2
# Allow Apache to create pid
chown -R apache:apache /run/apache2