Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 511  / 3 Years ago, thu, june 3, 2021, 8:09:35

I am trying to debug some weird behaviour on an apache 2.4 install on Ubuntu 14.04 server.

I notice if I remove all virtual hosts and additional configurations by commenting out their IncludeOptional lines from the apache.conf config file, e.g.



File: /etc/apache2/apache2.conf

# DISABLE generic snippets of statements
# IncludeOptional conf-enabled/*.conf

# DISABLE the virtual host configurations:
# IncludeOptional sites-enabled/*.conf


(Then restart apache)



If I browse to the server apache will still serve content from /var/www.



My question is, how or where is apache being "told" to use that as a document root?




  • is it some ultimate fall back DocumentRoot that is compiled into apache itself?

  • Ive looked in the apache configuration files and I can't find any DocumentRoot = /var/www directives?


More From » server

 Answers
2

There is an ultimate fallback DocumentRoot location. From the Apache docs:



Default:    DocumentRoot /usr/local/apache/htdocs


However, for packaging, the default is changed to /var/www (since packages aren't supposed to reside in or use /usr/local). The particular patch that does this is fhs_compliance.patch:



--- a/include/httpd.h
+++ b/include/httpd.h
@@ -109,7 +109,7 @@
#define DOCUMENT_LOCATION HTTPD_ROOT "/docs"
#else
/* Set default for non OS/2 file system */
-#define DOCUMENT_LOCATION HTTPD_ROOT "/htdocs"
+#define DOCUMENT_LOCATION "/var/www"
#endif
#endif /* DOCUMENT_LOCATION */


You can examine the full patch by downloading it (apt-get source apache2; cd apache2*; less debian/patches/fhs_compliance.patch) or online at Debian's packaging Git repository.


[#21110] Saturday, June 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
allowiel

Total Points: 189
Total Questions: 103
Total Answers: 105

Location: Slovenia
Member since Thu, Mar 18, 2021
3 Years ago
;