I am a neophyte on Apache, but I see some similar questions to this list and hope you can help.
I just want to set up a basic local LAMP system under my Ubuntu 18.04 LTS (Asus VivoBook S15) to test out a website that I have to modify before playing with the version on my commercial ISP host.
The basic installation went fine (Apache/2.4.29, PHP 7.2) and both html and php could be processed from the var/www/html folder through the url localhost. I then did the following to set up public_html access:
i) add in /etc/apache2/apache2.conf the line:
ServerName localhost:80
ii) activate the the UserDir module (sudo a2enmod userdir) and edit the file /etc/apache2/mods-enabled/userdir.conf as follows :
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
# AllowOverride FileInfo AuthConfig Limit Indexes
AllowOverride All
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Options ExecCGI Indexes MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Require method GET POST OPTIONS
</Directory>
</IfModule>
iii) activate default virtual user directory (sudo a2ensite 000-default.conf) and edit the file /etc/apache2/sites-enabled/000-default.conf as follows:
# Global configuration
ServerName localhost
# without port according to recommendation found on the web
and
#ServerAdmin webmaster@localhost
ServerAdmin john@john-VivoBook
#DocumentRoot /var/www/html
DocumentRoot /home/john/public_html
iv) created the public_html directory under my home directory (/home/john) with ownership john:john and permissions 755 (also tried with 777), and added my index.html and index.php files
v) restarted Apache (sudo apache2ctl restart)
vi) configured my Firefox browser not to add www to urls.
When I try to access the url "localhost" I get a blank screen, whereas with "localhost/public_html", "localhost/public_html/index.html" or "localhost/public_html/index.php" I get the message:
Not Found
The requested URL was not found on this server.
Apache/2.4.29 (Ubuntu) Server at localhost Port 80
No errors in the log file /var/log/apache2/error.log
The tail of the log file /var/log/apache2/access log says:
127.0.0.1 - - [05/Apr/2020:13:24:44 +0200] "GET /public_html HTTP/1.1" 404 488 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"
127.0.0.1 - - [05/Apr/2020:13:26:41 +0200] "GET /public_html/index.html HTTP/1.1" 404 488 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"
127.0.0.1 - - [05/Apr/2020:13:27:29 +0200] "GET /public_html/index.php HTTP/1.1" 404 488 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0"
The log file /var/log/apache2/other_vhosts_access.log does not exist.
What am I doing wrong?
Thanks and best regards, John