On Mon, 6 Apr 2020 06:26:21 +0000 "Russell L. Harris" <russ...@rlharris.org> wrote:
> I am searching for a guide for configuration of Apache 2.4 on Debian > 10. Thus far, my web searches have found guides for Debian 9 and > guides for Apache 2.2. > > I am aware of "https://httpd.apache.org/docs/2.4/" and am digesting it > as rapidly as I can. > > I have been working my way through the Chapter 11 tutorial of the > O'Reilly Perl Template Toolkit. I am about halfway through the > chapter, starting to create a menu. I can see the topmost page, > "index.html" and the menu, but when I click on any of the menu items, > the browser complains that the page cannot be found. For example, > "index.html" and "about.html" are in the same directory, but the > browser cannot display "about.html". > > After carefully checking my code against the example code published by > O'Reilly, I conclude that I must have an error in my Apache 2.4 > configuration. > > The HTML generated by the toolkit is placed in the directory > "/home/rlh/web/ttbook/html/", while images are placed in > "/home/rlh/web/ttbook/images/". The tutorial, written for Apache > 2.2, recommends: > > Alias /ttbook/images/ /home/rlh/web/ttbook/images/ > Alias /ttbook/ /home/rlh/web/ttbook/html/ > Directory /home/rlh/web/ttbook/ > > Supposedly, the result is: > > = The root document URL is "/ttbook/". > = The root images URL is "/ttbook/images/". > = The default host is "http://localhost/". > > With my current mis-configuration, the generated HTML is visible at > "file:///home/rlh/web/ttbook/html/index.html" but not at > "http://localhost/index.html". Unless you have changed the DocumentRoot directive in the site you are using (by default, 000-default.conf in /etc/apache2/sites-available) then http://localhost/index.html will show you the file /var/www/html/index.html. If you've placed your alias correctly, then you will need to use http://localhost/ttbook to see your own index.html file. If you use a filename other than 'index.html' (or other defaults like index.php) then you'll need to specify it after '..../ttbook/'. > > I think that, to begin with, I need to find a good explanation of the > concept of "localhost". Hopefully that is somewhere in the Apache 2.4 > official documentation. > > Localhost is the machine running Apache. The normal IP address for it is 127.0.0.1, though there are others. It isn't an Apache thing, it's a networking thing. It's referred to in network configuration as 'lo'. If you install Apache2.X on Debian, do nothing else at all, and enter just 'localhost' in a web browser address window (running on the same machine as Apache) then you will see the Apache 2 Debian Default Page, at /var/www/html/index.html which basically shows that Apache is running, and gives a few details about configuration. If you can see this page, or whatever you may have replaced it with, then Apache is running, which is half the problem solved. Always check this first if you have problems (I leave this page in place, despite the encouragement to replace it) as Apache is quite fussy, and will refuse to run under some conditions. If it's not running, check /var/log/apache2/error.log for the reason. -- Joe