Files
buildroot/package/apache/S50apache
Fiona Klute 1006666f67 package/apache: use "Debian" filesystem layout to fix read-only rootfs
The previous configuration placed both logs and PID file in /var/logs,
which is not writable with a read-only rootfs (e.g. squashfs), as well
as non-standard. Starting HTTPD during boot failed with:

(30)Read-only file system: AH00091: httpd: could not open error log file /var/logs/error_log.
AH00015: Unable to open logs

An additional issue was that the Buildroot-default --prefix=/usr
override meant various Apache-internal directories (e.g. htdocs) were
placed directly in /usr. Note that the upstream default prefix is
/usr/local/apache2, not /usr/local.

Using the "Debian" layout provides a standard-compatible layout with
logs in /var/log/apache2 and PID file in /var/run/apache2 (both in
tmpfs with the default Buildroot fstab). Both directories need to
exist when the server starts, so handle that in the init script.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2026-08-16 16:49:59 +02:00

18 lines
343 B
Bash

#!/bin/sh
# shellcheck disable=SC2034 # checkpackage-required variable
DAEMON="apache"
mkdir -p "/var/log/apache2" "/var/run/apache2"
case "$1" in
start|restart|graceful|graceful-stop|stop)
apachectl -k "$1"
;;
reload)
apachectl -k restart
;;
*)
echo "Usage: $0 {start|restart|reload|graceful|graceful-stop|stop}"
exit 1
esac