logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: httpd on Arch: Warning: DocumentRoot does not exist
Author
altesCoon



Joined: 10 Nov 2025
Posts: 4
Location: Germany

PostPosted: Mon 10 Nov '25 21:45    Post subject: httpd on Arch: Warning: DocumentRoot does not exist Reply with quote

Hi there.

My virtual host on my newly installed Linux Arch machine lives in /home/peter/www/test.de, so in my user directory.

In my /etc/httpd/conf/httpd.conf I include its config file:

Code:
# my own virtual hosts:
Include conf/vhosts/test.de.conf


My file /etc/httpd/conf/vhosts/test.de.conf (taken from a working ubuntu-installation of apache2):

Code:
<VirtualHost *:80>
  ServerAdmin webmaster@test.de
  DocumentRoot /home/peter/www/test.de
  ServerName test.de
  ErrorLog ${APACHE_LOG_DIR}/test-error.log
  CustomLog ${APACHE_LOG_DIR}/test-access.log combined

  <Directory />
    Order deny,allow
    deny from all
  </Directory>
 
  <Directory "/home/peter/www/test.de">
    Options Indexes FollowSymLinks Includes
    AllowOverride None
    Order allow,deny
    Allow from all
    Require all granted
  </Directory>
</VirtualHost>


/home/peter/www/test.de exists:

Code:
ls -l /home/peter/www/
drwxrwxr-x 37 peter peter 4096  4. Nov 07:42 test.de


As httpd user I set peter in /etc/httpd/conf/httpd.conf:

Code:
User peter
Group peter


After starting httpd I get this status:

Code:
sudo systemctl status httpd
[sudo] Passwort für peter:
● httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
    Drop-In: /etc/systemd/system/httpd.service.d
             └─hardening.conf
     Active: active (running) since Thu 2025-11-06 19:27:28 CET; 17min ago
 Invocation: 7c63b1b8790842109a1fe913c429d15f
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 66375 (httpd)
     Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec"
      Tasks: 6 (limit: 37517)
     Memory: 12M (peak: 13M)
        CPU: 112ms
     CGroup: /system.slice/httpd.service
             ├─66375 /usr/bin/httpd -D FOREGROUND -k start
             ├─66377 /usr/bin/httpd -D FOREGROUND -k start
             ├─66378 /usr/bin/httpd -D FOREGROUND -k start
             ├─66379 /usr/bin/httpd -D FOREGROUND -k start
             ├─66380 /usr/bin/httpd -D FOREGROUND -k start
             └─66381 /usr/bin/httpd -D FOREGROUND -k start

Nov 06 19:27:28 pt systemd[1]: Starting The Apache HTTP Server...
Nov 06 19:27:28 pt httpd[66375]: AH00112: Warning: DocumentRoot [/home/peter/www/test.de] does not exist
Nov 06 19:27:28 pt httpd[66375]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::ff88:bb59:947e:c7fe%enp5s0. Set the 'ServerName' directive globally to suppress this message
Nov 06 19:27:28 pt systemd[1]: Started The Apache HTTP Server.


There is a warning:

Code:
Warning: DocumentRoot [/home/peter/www/test.de] does not exist


But as mentioned above it does exist.
Calling test.de in browser shows no website (test.de is included in /etc/hosts).

Any hints?

Regards, Peter
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 405
Location: UK

PostPosted: Tue 11 Nov '25 22:15    Post subject: Reply with quote

I've installed a VirtualBox instance of Arch Linux to try and reproduce your problem with the additional included configuration file, but haven't succeeded. For me Apache works as expected.

Having created a user (peter) to run Apache, I get no error message when starting Apache, viz.
Code:
● httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
    Drop-In: /etc/systemd/system/httpd.service.d
             └─hardening.conf
     Active: active (running) since Tue 2025-11-11 19:29:17 GMT; 23min ago
 Invocation: e2967056bbc14dd0b41abbe929d53c31
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 2672 (httpd)
     Status: "Total requests: 8; Idle/Busy workers 100/0;Requests/sec: 0.0056; Bytes served/sec:   2 B/sec"
      Tasks: 82 (limit: 4612)
     Memory: 7.4M (peak: 7.6M)
        CPU: 64ms
     CGroup: /system.slice/httpd.service
├─66375 /usr/bin/httpd -D FOREGROUND -k start
             ├─26377 /usr/bin/httpd -D FOREGROUND -k start
             ├─26378 /usr/bin/httpd -D FOREGROUND -k start
             ├─26379 /usr/bin/httpd -D FOREGROUND -k start
             ├─26380 /usr/bin/httpd -D FOREGROUND -k start
             └─26381 /usr/bin/httpd -D FOREGROUND -k start

Nov 11 19:29:16 minerva systemd[1]: Starting The Apache HTTP Server...
Nov 11 19:29:17 minerva httpd[2672]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::507e:89c7:fe99:aebc%enp0s3. Set the 'ServerName' directive globally to suppress this message
Nov 11 19:29:17 minerva systemd[1]: Started The Apache HTTP Server.

Do you have a filesystem permissions issue accessing the DocumentRoot, or something else? What happens if you run Apache under the root account?

Incidentally, your Ubuntu section is based on Apache 2.2 style configuration settings, rather than 2.4. Instead of "Order, Deny, Allow" statements you should consider using "Require" directives, see https://httpd.apache.org/docs/trunk/upgrading.html

Let us know if you manage to solve this problem.
Back to top
altesCoon



Joined: 10 Nov 2025
Posts: 4
Location: Germany

PostPosted: Wed 12 Nov '25 11:33    Post subject: Reply with quote

Oh, thank you to join me Smile

tangent wrote:

Do you have a filesystem permissions issue accessing the DocumentRoot, or something else?


See my permissions here. Seems all right:

Code:
[peter@pt ~]$ ls -l /
drwxr-xr-x   4 root root  4096 20. Aug 13:06 home
[peter@pt ~]$ ls -l /home
drwxr-x--x 38 peter peter  4096  7. Nov 18:48 peter
[peter@pt ~]$ ls -l /home/peter
drwxrwxr-x  3 peter peter    4096  6. Nov 19:23  www
peter@pt ~]$ ls -l /home/peter/www
drwxrwxr-x 37 peter peter 4096 12. Nov 08:27 test.de
peter@pt ~]$ ls -l /home/peter/www/test.de
-rw-rw-r-- 1 peter peter 15  8. Okt 20:46 index.html


Apache is running as user peter:
Code:
[peter@pt ~]$ ps aux | grep apache
peter     298876  0.0  0.0   6892  4456 pts/1    S+   10:12   0:00 grep --color=auto apache


tangent wrote:
What happens if you run Apache under the root account?


I always started the service with sudo:
Code:
sudo systemctl start httpd

Did you mean that?

I changed the configuration settings to 2.4-style. Thank you for this hint. But it changed nothing up to here.

Thank you very much
Peter
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 405
Location: UK

PostPosted: Wed 12 Nov '25 20:04    Post subject: Reply with quote

Further to your comments over file permissions, I've revisited my Arch Linux VM Apache, this time using the default configuration file, plus a copy of your additional configuration file test.de.conf (though I've placed that in /etc/httpd/conf/conf.d).

Presume you installed Apache using standard pacman, viz:

Code:
[root@minerva ~]# pacman -S httpd
resolving dependencies...
looking for conflicting packages...

Packages (3) apr-1.7.6-1  apr-util-1.6.3-2  apache-2.4.65-4

Total Installed Size:  8.24 MiB

:: Proceed with installation? [Y/n]

Apache isn't happy (and won't therefore start), since its unable to find the ${APACHE_LOG_DIR} variable your configuration references, viz:

Code:
[root@minerva ~]# apachectl -t
[Wed Nov 12 17:23:14.053009 2025] [core:warn] [pid 4685:tid 4685] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Wed Nov 12 17:23:14.053052 2025] [core:warn] [pid 4685:tid 4685] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::507e:89c7:fe99:aebc%enp0s3. Set the 'ServerName' directive globally to suppress this message
(2)No such file or directory: AH02291: Cannot access directory '/etc/httpd/${APACHE_LOG_DIR}/' for error log of vhost defined at /etc/httpd/conf/conf.d/test.de.conf:1
AH00014: Configuration check failed

So what changes have you made to the default configuration, and where is that variable defined such that systemctl (or apachectl) find it?

As per the root question, I meant what happens if you configure Apache to run as root rather than peter, i.e.

Code:
<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch. 
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User root
Group root

</IfModule>
Back to top
altesCoon



Joined: 10 Nov 2025
Posts: 4
Location: Germany

PostPosted: Wed 12 Nov '25 22:51    Post subject: Reply with quote

tangent wrote:

So what changes have you made to the default configuration, and where is that variable defined such that systemctl (or apachectl) find it?


Oh, sorry for not have mentioned. To keep my conf file compatible to the ubuntu-installation I added this variable in /etc/httpd/conf/httpd.conf right before including my virtual host conf file:

Code:
# this is used in .conf-files:
Define APACHE_LOG_DIR /var/log/httpd
# my own virtual hosts:
Include conf/vhosts/test.de.conf



tangent wrote:

As per the root question, I meant what happens if you configure Apache to run as root rather than peter, i.e.

Code:
User root
Group root



Ah I see. httpd doesn't start as root:

Code:

Nov 12 21:33:03 pt systemd[1]: Starting The Apache HTTP Server...
Nov 12 21:33:03 pt httpd[348517]: AH00526: Syntax error on line 207 of /etc/httpd/conf/httpd.conf:
Nov 12 21:33:03 pt httpd[348517]: Error:\tApache has not been designed to serve pages while\n\trunning as root.  There are known race conditions that\n\twill allow any local user to read any file on the system.\n\tIf you still desire to serve pages as root then\n\tadd -DBIG_SECURITY_HOLE to the CFLAGS env variable\n\tand then rebuild the server.\n\tIt is strongly suggested that you instead modify the User\n\tdirective in your httpd.conf file to list a non-root\n\tuser.\n
Nov 12 21:33:03 pt systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Nov 12 21:33:03 pt systemd[1]: httpd.service: Failed with result 'exit-code'.
Nov 12 21:33:03 pt systemd[1]: Failed to start The Apache HTTP Server.


Let me say that I am very thankful, that you try so many things to help me solving my problem. I'm afraid I have to start all over again in some way.

Peter
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 405
Location: UK

PostPosted: Wed 12 Nov '25 23:35    Post subject: Reply with quote

Thanks for the explanation; that makes sense now.

Plus apologies for my mistake; I should have remembered Apache won't run child processes as root for security reasons.

Unfortunately, since I can't reproduce your problem, I'm struggling to advise further.

One thing I'd try is moving your test.de folder away from your home directory, to say /var/www/test.de, just in case there's some other access control restrictions on your system (e.g. selinux).
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 617
Location: Milford, MA, USA

PostPosted: Fri 14 Nov '25 17:03    Post subject: SystemD ProtecctHome setting Reply with quote

Arch Linux recently changed the SystemD unit file for Apache to enable the ProtectHome option, which prevents access to files beneath the /home directory. This could be your problem.

See this post for details about ProtectHome and how to override it..

-tom-
Back to top
tangent
Moderator


Joined: 16 Aug 2020
Posts: 405
Location: UK

PostPosted: Fri 14 Nov '25 18:00    Post subject: Reply with quote

Thankyou for this detail. One never stops learning...

When testing, I was running HTTPD manually rather than through systemctl.

A quick check confirms this ProtectHome property is active on the httpd.service on my test instance of Arch Linux, and so is the likely cause of the original problem.
Code:
[root@minerva ~]# systemctl show --property=ProtectHome httpd.service
ProtectHome=yes
Back to top
altesCoon



Joined: 10 Nov 2025
Posts: 4
Location: Germany

PostPosted: Sat 15 Nov '25 14:52    Post subject: Re: SystemD ProtecctHome setting Reply with quote

tdonovan wrote:
Arch Linux recently changed the SystemD unit file for Apache to enable the ProtectHome option, which prevents access to files beneath the /home directory.

This could be your problem.


Yes, it was, tom! Smile

The actions presented in the link did the trick.

With:
Code:
systemctl show httpd | grep Protect

I get:
Code:
...
ProtectHome=yes
...

So I knew this is my problem.

Then I did:
Code:
sudo systemctl edit httpd.service

and added this to the new created file etc/systemd/system/httpd.service.d/override.conf:
Code:
[Service]
ProtectHome=read-only

Then, almost all worked! Almost, because my websites write cache files inside a folder in document root via php. So I had to go a step further and said:
Code:
[Service]
ProtectHome=no

Now everything works fine like it did before.
Thank you both for supporting me!

Peter
Back to top


Reply to topic   Topic: httpd on Arch: Warning: DocumentRoot does not exist View previous topic :: View next topic
Post new topic   Forum Index -> Apache