Saturday, May 18, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 25619  / 3 Years ago, sun, november 28, 2021, 7:09:01

I have a brand-new installation of Ubuntu 16.04 LTS Server (32bit) with enabled LAMP packages. Which means out of the box, it serves the typical Apache2 Ubuntu Default Page on port 80, located under /var/www/html/index.html.



One of the first things I did was to try and disable that page, using the venerable



sudo a2dissite 000-default.conf


command, which prompted me to do



service apache2 reload


which I also called with sudo.



To my surprise, after that, the site is still accessible: Re-loading and shift-reloading in Firefox still shows the page and I can see the requests in /var/log/apache2/other_vhosts_access.log.



Running the a2dissite command again shows Site 000-default already disabled and the directory /etc/apache2/sites-enabled/ is empty.



What am I doing wrong?



EDIT:



As for the suggestions by Julius Š., I also tried



sudo service apache2 restart


with the same result and checked my /etc/apache2/apache2.conf file, which shows <VirtualHost> only in some comments.



Regarding <Directory> entries, these are just the defaults in the file:



<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>


Could it be some plugins searching in /var/www/ subfolders for suitable html files?



EDIT 2:



I also rebooted the machine, the site is still accessible.



Only stopping the service makes it become inaccessible. Since I plan to run other sites on it, I will eventually need to have it running, so I am really curious what's going on.



EDIT 3:



As I found in this answer on SO, the virtualhost settings from the config file can be displayed as follows:



. /etc/apache2/envvars
apache2 -S


...which in my case, outputs the following:



AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used


I got a bit suspicious about the DocumentRoot entry pointing to /var/www/html, so I did a



find |xargs grep DocumentRoot 2>/dev/null


within the /etc/apache2 folder, which led to the following:



./sites-available/default-ssl.conf:     DocumentRoot /var/www/html
./sites-available/000-default.conf: DocumentRoot /var/www/html


...so nothing in any of the *-enabled/ subfolders containing that string. I really wonder where Apache gets the DocumentRoot from when nothing seems to be enabled.


More From » apache2

 Answers
3

DocumentRoot has a default value that's used if it is not set. That would mean that Apache would serve out of some directory even if DocumentRoot was not set anywhere in the configuration.



For the upstream Apache source, that is /usr/local/apache/htdocs, but the Ubuntu packaging overrides that with --enable-layout=Debian. That is presumably why it continues to serve with /var/www/html as DocumentRoot. If you just want it to stop loading that page, make it inaccessible to the www-data user by changing permissions, or set DocumentRoot to some other directory.


[#13188] Monday, November 29, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
peafowkes

Total Points: 356
Total Questions: 102
Total Answers: 117

Location: Lebanon
Member since Tue, Oct 12, 2021
3 Years ago
;