mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-10 16:24:17 -09:00
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>
(cherry picked from commit 1006666f67)
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
This commit is contained in:
committed by
Titouan Christophe
parent
b5e04eab73
commit
6c1d649fcb
@@ -2,6 +2,8 @@
|
||||
# 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"
|
||||
|
||||
@@ -43,7 +43,9 @@ APACHE_CONF_OPTS = \
|
||||
--without-suexec-bin \
|
||||
--enable-mods-shared=all \
|
||||
--with-mpm=$(APACHE_MPM) \
|
||||
--disable-luajit
|
||||
--disable-luajit \
|
||||
--enable-layout=Debian \
|
||||
--prefix=/
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BROTLI),y)
|
||||
APACHE_CONF_OPTS += --enable-brotli
|
||||
@@ -102,13 +104,15 @@ endif
|
||||
|
||||
define APACHE_FIX_STAGING_APACHE_CONFIG
|
||||
$(SED) 's%"/usr/bin"%"$(STAGING_DIR)/usr/bin"%' $(STAGING_DIR)/usr/bin/apxs
|
||||
$(SED) 's%/usr/build%$(STAGING_DIR)/usr/build%' $(STAGING_DIR)/usr/bin/apxs
|
||||
$(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/usr%' $(STAGING_DIR)/usr/build/config_vars.mk
|
||||
$(SED) 's%/usr/share/apache2/build%$(STAGING_DIR)/usr/share/apache2/build%' $(STAGING_DIR)/usr/bin/apxs
|
||||
$(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/%' $(STAGING_DIR)/usr/share/apache2/build/config_vars.mk
|
||||
$(SED) 's%^sbindir =.*%sbindir = $(STAGING_DIR)/usr/sbin%' $(STAGING_DIR)/usr/share/apache2/build/config_vars.mk
|
||||
$(SED) 's%^includedir = .*%includedir = $(STAGING_DIR)/usr/include/apache2%' $(STAGING_DIR)/usr/share/apache2/build/config_vars.mk
|
||||
endef
|
||||
APACHE_POST_INSTALL_STAGING_HOOKS += APACHE_FIX_STAGING_APACHE_CONFIG
|
||||
|
||||
define APACHE_CLEANUP_TARGET
|
||||
$(RM) -rf $(TARGET_DIR)/usr/manual $(TARGET_DIR)/usr/build
|
||||
$(RM) -rf $(TARGET_DIR)/usr/share/apache2/default-site/htdocs/manual $(TARGET_DIR)/usr/share/apache2/build
|
||||
endef
|
||||
APACHE_POST_INSTALL_TARGET_HOOKS += APACHE_CLEANUP_TARGET
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStartPre=/bin/mkdir -p /var/log/apache2 /var/run/apache2
|
||||
ExecStart=/usr/bin/apachectl start
|
||||
ExecReload=/usr/bin/apachectl graceful
|
||||
ExecStop=/usr/bin/apachectl stop
|
||||
|
||||
Reference in New Issue
Block a user