Differences between revisions 4 and 5
Revision 4 as of 2020-08-30 17:22:34
Size: 1316
Editor: scot
Comment:
Revision 5 as of 2020-08-30 17:58:58
Size: 3315
Editor: scot
Comment:
Deletions are marked like this. Additions are marked like this.
Line 19: Line 19:
One thing you should learn about Linux systems in general is that they almost always include documentation,AND THAT DOCUMENTATION IS SPECIFIC TO THE PLATFORM YOU ARE ON! In this case You will notice that the documentation for this installation references {{{/usr/share/doc/apache2/README.Debian.gz}}}. This tells us that the documentation for this installation (which builds on the Debian distribution) is gzipped and the location of that file. The first thing you might notice is the location of the resources (web pages) that the server will look in. {{{/var/www/html}}}

The second thing you should know
about Linux systems in general is that they almost always include documentation,AND THAT DOCUMENTATION IS SPECIFIC TO THE PLATFORM YOU ARE ON! In this case You will notice that the documentation for this installation references {{{/usr/share/doc/apache2/README.Debian.gz}}}. This tells us that the documentation for this installation (which builds on the Debian distribution) is gzipped and the location of that file.
Line 24: Line 26:

 * Show the man page - it has a list of files and their locations. Look at each one and point out the important parts
 * {{{/etc/apache2/apache2.conf}}}
   * Notice the reference to official documentation from Apache [[http://httpd.apache.org/docs/2.4]]
   * Notice that this configuration varies significantly from the upstream's suggested way to configure the server. This doesn't mean that the server is configured differently and that the official docs are not relevant, but instead that the layout of the files and where we put configuration information is different.
   * We get a hint that Apache was at one time configured by a single .conf file. (httpd.conf or apache2.conf) and that the separation of information into different files is for our benefit.
   * ports.conf is very short and we can divert there for a moment - it exists to define the ports on which to listen.
     * Notice the {{{<IfModule ###>...</...>}}}. These check for a module and if it is loaded, then we define the listening port for that module.
   * Directory {{{mods-enabled/}}} contains module configuration information
   * Directory {{{conf-enabled/}}} links to files in {{{conf-available}}}. Apache2 loads configuration files from {{{conf-available}}} if {{{conf-enabled/}}} contains a link to them. This is how we switch on and off configurations without deleting them.
   * Similarly {{{mods-available}}} contains a list of installed modules and their configurations. Look at the ssl.conf file. This is the setup of the module, not the setup of SSL for a website (of which we can host many with Apache). So don't get these confused. We rarely edit files here.
   * Similarly {{{sites-available}}} contains a list of available web sites and their configurations. Lets look at what is enabled and then at the configuration associated configuration file.

Apache Web Server

Note: This page has comments

How to Install, Configure (Server, Virtual Hosts, etc.), Secure, and manage Logs on for Apache 2 on Ubuntu.

Install

The simplest task is installing Apache 2 on Ubuntu. This process has not changed significantly in several versions.

sudo apt install apache2

After this finishes, all required packages are installed and we can test it by going to the default page on our server with a browser. Usually you should see something like this:

Apache2_defautl_page.png

The first thing you might notice is the location of the resources (web pages) that the server will look in. /var/www/html

The second thing you should know about Linux systems in general is that they almost always include documentation,AND THAT DOCUMENTATION IS SPECIFIC TO THE PLATFORM YOU ARE ON! In this case You will notice that the documentation for this installation references /usr/share/doc/apache2/README.Debian.gz. This tells us that the documentation for this installation (which builds on the Debian distribution) is gzipped and the location of that file.

How would you look at that file without unzipping it? less /usr/share/doc/apache2/README.Debian.gz will show you the page just as if it was a man page.

Demo:

  • Show the man page - it has a list of files and their locations. Look at each one and point out the important parts
  • /etc/apache2/apache2.conf

    • Notice the reference to official documentation from Apache http://httpd.apache.org/docs/2.4

    • Notice that this configuration varies significantly from the upstream's suggested way to configure the server. This doesn't mean that the server is configured differently and that the official docs are not relevant, but instead that the layout of the files and where we put configuration information is different.
    • We get a hint that Apache was at one time configured by a single .conf file. (httpd.conf or apache2.conf) and that the separation of information into different files is for our benefit.
    • ports.conf is very short and we can divert there for a moment - it exists to define the ports on which to listen.
      • Notice the <IfModule ###>...</...>. These check for a module and if it is loaded, then we define the listening port for that module.

    • Directory mods-enabled/ contains module configuration information

    • Directory conf-enabled/ links to files in conf-available. Apache2 loads configuration files from conf-available if conf-enabled/ contains a link to them. This is how we switch on and off configurations without deleting them.

    • Similarly mods-available contains a list of installed modules and their configurations. Look at the ssl.conf file. This is the setup of the module, not the setup of SSL for a website (of which we can host many with Apache). So don't get these confused. We rarely edit files here.

    • Similarly sites-available contains a list of available web sites and their configurations. Lets look at what is enabled and then at the configuration associated configuration file.

WebServices/LectureNotes/LectureNotes02 (last edited 2020-09-01 14:20:26 by scot)