问题原文
原帖链接 · Roger Dueck · CC BY-SA 4.0
I have the following directories, where /data is the mount point for a data partition, and /var is a symlink:
lrwxrwxrwx 1 root root 9 Nov 20 13:25 /var -> /data/var
lrwxrwxrwx 1 root root 9 Nov 20 23:41 /var/lock -> /run/lock
drwxr-xr-x 5 root root 4096 Nov 20 13:42 /data
drwxr-xr-x 12 root root 4096 Nov 21 01:44 /data/var
drwxr-xr-x 6 root root 4096 Dec 18 06:25 /data/var/log
drwxr-x--- 3 root adm 4096 Dec 8 06:25 /data/var/log/apache2/
Apache seems to have issues with this approach:
mktemp: failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file or directory
I solved that by changing /etc/apache2/envvars to refer to /run/lock directly, but the next error wasn't solved by changing APACHE_LOG_DIR in envvars:
(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for main error log
(2)No such file or directory: AH02291: Cannot access directory '/var/log/apache2/' for error log of vhost defined at /etc/apache2/sites-enabled/site.conf:2
AH00014: Configuration check failed
How can I make this work?
已采纳解答
原帖链接 · Roger Dueck · CC BY-SA 4.0
The solution is to bind mount, not symlink, as recommended here, with reasoning against the symlink to /var given in point #7:
the hierarchy standard dictates that it must be a directory
In my case, switching from symlink to bind mount was accomplished with:
sudo -s
rm /var && mkdir -p /var && mount -o bind /data/var /var
cat >> /etc/fstab << END
/data/var /var none bind 0 0
END
and now apache starts without complaint.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
