\input{gl2.slide-header-beamer}
\errorcontextlines=99
%% Subtopic Number = '1.113.3'
%% Title: Operate and perform basic configuration of Apache
%% Weight: 4
%% Description:
%% Candidates should be able to modify simple parameters in
%%       Apache configuration files, start, stop, and restart httpd, arrange for
%%       automatic restarting of httpd upon boot. Does not include advanced
%%       custom configuration of Apache.
%% Key files, terms, and utilities include:
%%        httpd.conf
%%        apachectl
%%        httpd
\title{1.113.3\\Operate and perform basic configuration of
  Apache\\Weight 4}
\author[Andrew Eager]{Andrew Eager \texttt{andrew.eager@aes-pl.com.au} \and Geoffrey Robertson \texttt{ge@ffrey.com} \and Nick Urbanik \texttt{nicku@nicku.org}\\
  {\tiny This document Licensed under GPL---see
    section~\ref{sec:license}}}%
\subtitle{Linux Professional Institute Certification --- 102}%
\mode<article>{\chead{1.113.3}}%


\begin{document}
\maketitle
\mode<article>{\thispagestyle{empty}}

\begin{frame}
  \frametitle{Outline}
  \mode<presentation>
  {%
    %\footnotesize
    \begin{multicols}{2}
      \tableofcontents
    \end{multicols}
    % You might wish to add the option [pausesections]
  }%
  \mode<article>
  {%
    \tableofcontents
  }%
\end{frame}

\section{Context}
\label{sec:context}

\begin{frame}
  \frametitle{Topic 113 Networking Services [24]}%
  \framesubtitle{Where we are up to}%
    \begin{description}
    \item[1.113.1] Configure and manage inetd, xinetd, and related services [4]
    \item[1.113.2] Operate and perform basic configuration of sendmail [4]
    % \uline depends on \usepackage[normalem]{ulem}:
    \item[1.113.3] \textbf{\uline{Operate and perform basic
          configuration of Apache [4]}}
    \item[1.113.4] Properly manage the NFS, smb, and nmb daemons [4]
    \item[1.113.5] Setup and configure basic DNS services [4]
    \item[1.113.7] Set up secure shell (OpenSSH) [4]
    \end{description}
\end{frame}

\section{Objective}
\label{sec:objective}

\begin{frame}
  \frametitle{Description of Objective}%
  \framesubtitle{1.113.3\ \ Operate and perform basic configuration of
    Apache}%
  \mode<presentation>{\Large}%
  Candidates should be able to modify simple parameters in Apache
  configuration files, start, stop, and restart httpd, arrange for
  automatic restarting of httpd upon boot. Does not include advanced
  custom configuration of Apache.
\end{frame}

\begin{frame}
  \frametitle{Key files, terms, and utilities include:}%
  \framesubtitle{1.113.3\ \ Operate and perform basic configuration of
    Apache}%
  \mode<presentation>{\Large}%
\begin{description}
 \item[\texttt{httpd.conf}] --- main configuration file for Apache
 \item[\texttt{apachectl}] --- a program to send commands to a running
   Apache server, especially the \texttt{graceful} command
 \item[\texttt{httpd}] --- the Apache server program
\end{description}
\end{frame}

\section{Resources}
\label{sec:resources}

\begin{frame}
  \frametitle{Operate and Perform Basic Configuration of Apache}%
  \framesubtitle{Resources of Interest}%
  \begin{description}
  \item[Apache home page:] \url{http://httpd.apache.org}
  \end{description}
\end{frame}


\section{Intro to Apache}
\label{sec:intro-to-apache}


\begin{frame}
  \frametitle{Apache}
  \begin{itemize}
  \item Apache is a web server (http daemon)
  \item Default on all Linux distros
  \item Most popular web server on the internet
  \item Named after the number of patches to orginal source code
  \item Provides both HTTP and HTTPS (SSL) as standard
  \item Other features added with modules (eg cgi)
  \end{itemize}
\end{frame}

\section{Starting and Stopping Apache}
\label{sec:starting-and-stopping-apache}


\begin{frame}
  \frametitle{Starting and Stopping Apache}
  \begin{itemize}
  \item Apache can be started:
    \begin{itemize}
    \item On demand through \texttt{inetd} or \texttt{xinetd}
    \item As a daemon
    \end{itemize}
  \item Normally started as daemon to reduce connect delay
  \item Uses standard SysV start/stop semantics
    \begin{itemize}
    \item Debian, Red Hat: \cmdbox{sudo /etc/init.d/apache start}
    \item Red Hat/Fedora: \cmdbox{sudo service httpd start}
    \end{itemize}
  \item An alternative is \texttt{apachectl}
    \begin{itemize}
    \item \cmdbox{sudo service httpd graceful} actually calls
      \texttt{apachectl}
    \end{itemize}
  \end{itemize}
\end{frame}

\section{\texttt{apachectl}}
\label{sec:apachectl}


\begin{frame}
  \frametitle{\texttt{apachectl}}%
  apachectl is a management utility. To use it:
  \par
  \cmd{sudo apachectl \meta{command}}
  \par\bigskip\par%
  \begin{tabular}[t]{@{}>{\ttfamily}ll@{}}
    \toprule%
    \textnormal{\emph{command}} & \emph{function} \\
    \midrule%
    start & Start the daemon \\
    stop & Stop the daemon \\
    restart & Restart or start the daemon \\
    fullstatus & Report status of server (requires lynx) \\
    graceful & Gracefully restart the server \\
    configtest & Test config file syntax \\
    help & Display commands \\
    \bottomrule
  \end{tabular}
\end{frame}

\section{\texttt{httpd} options}
\label{sec:httpd-options}

\begin{frame}
  \frametitle{\texttt{httpd} Options}%
  The \texttt{httpd} deamon can be run directly if needed. On Debian
  the daemon is called \texttt{apache}.
  \par\bigskip\par%
  \begin{tabular}[t]{@{}>{\ttfamily}ll@{}}
    \toprule%
    \textnormal{\emph{Option}} & \emph{Function} \\
    \midrule%
    -v & Shows version \\
    -V & Shows compile configuration \\
    -h & List all cmd line parameters \\
    -l & List compiled in modules \\
    -L & List config directives \\
    -S & Shows parsed settings (virtual hosts only) \\
    -t & Test config file \& doc root \\
    -T & Test config file only \\
    \bottomrule
  \end{tabular}
\end{frame}

\subsection{\texttt{httpd} Options with Parameters}
\label{sec:httpd-options-with-parameters}

\begin{frame}
  \frametitle{\texttt{httpd} options with parameters}%
  The following options take parameters:
  \par
  \begin{tabular}[t]{@{}>{\ttfamily}ll@{}}
    \toprule%
    \textnormal{\emph{Parameter}} & \emph{Function} \\
    \midrule
    -D \meta{name}        & Defines a name for use in \texttt{IfDefine} name\\
    -d \meta{directory}   & Defines an alternate server root\\
    -f \meta{file}        & Set a new configuration file\\
    -C \meta{"directive"} & Process directive before reading config file\\
    -c \meta{"directive"} & Process directive after reading config file\\
    \bottomrule
  \end{tabular}
\end{frame}

\section{Configuring Apache}
\label{sec:configuring-apache}

\begin{frame}
  \frametitle{Configuring Apache}
  \begin{itemize}
  \item Apache originally (a decade ago) used 3 configuration files:
    \begin{itemize}
    \item \texttt{httpd.conf} --- Server settings
    \item \texttt{srm.conf} --- File types \& doc specs
    \item \texttt{access.conf} --- Security settings
    \end{itemize}
  \item All configuration is now done in \texttt{httpd.conf}
  \item Normally located in \texttt{/etc/httpd/conf}
  \end{itemize}
\end{frame}

\subsection{Site-wide Directives}
\label{sec:site-wide-directives}

\begin{frame}
  \frametitle{Site-wide Directives}
  \begin{tabular}[t]{@{}>{\ttfamily}ll@{}}
    \toprule%
    \textnormal{\emph{Directive}} & \emph{Function}\\
    \midrule%
    ServerAdmin     & Sets email address for admin\\
    ServerName      & Sets the name of the server\\
    DocumentRoot    & Sets the root for content served\\
    ServerRoot      & Sets root for server files\\
    ServerType      & \texttt{standalone} or \texttt{inetd}\\
    MinSpareServers & No of free httpd's before starting more\\
    MaxSpareServers & No of free httpd's before killing some\\
    StartServers    & No of httpd's to start\\
    MaxClients      & Maximum no of httpd's to run at once.\\
    \bottomrule
  \end{tabular}
\end{frame}

\subsection{Directory block Directives}
\label{sec:directory-block-directives}

\begin{frame}[fragile]
  \frametitle{Directory block Directives}%
  You can set directives so that thay only apply to a particular part
  of the content directory tree. For example:
\begin{semiverbatim}
<Directory /Games>
            AllowOverride None
</Directory>
\end{semiverbatim}
  This says that the \texttt{.htaccess} file can not override settings
  for this directory
\end{frame}


\subsection{Access Control}
\label{sec:access-control}

\begin{frame}[fragile]
  \frametitle{Access Control} This directive controls who can access
  what directories on your site. This is about the only directive that
  needs to be changed from an `off-the-shelf' configuration if you
  don't want external users to access your site.
\begin{semiverbatim}
<Location />
      order deny,allow
      deny from all
      allow from 127.0.0.0/255.0.0.0
      allow from .c222
</Location>
\end{semiverbatim}
  This says to deny first then allow. The result is that only users in
  the .c222 domain and the localhost will be able to access the server.
\end{frame}

\subsection{Other Directives}
\label{sec:other-directives}

\begin{frame}
  \frametitle{Other Directives}%
  There are a large number of configuration directives. These are
  grouped as follows:
  \begin{itemize}
  \item Aliases and Redirects
  \item Default pages
  \item User Web Directories (site content in a users home)
  \item MIME types
  \item CGI files
  \item Directory Browsing
  \item Authentication
  \item Virtual hosts (multiple sites on one host)
  \item Logging directives
  \end{itemize}
\end{frame}


\mode<presentation>
{%
\begin{frame}
  \frametitle{Topics Covered}
  %\footnotesize
  %\begin{multicols}{2}
    \tableofcontents[pausesections,pausesubsections]
  %\end{multicols}
  % You might wish to add the option [pausesections]
\end{frame}
}

\section{License of this Document}
\label{sec:license}

\begin{frame}
  \frametitle{License of this Document}%
  \raggedright%
  Copyright \copyright\ 2005, 2003 Andrew Eager
  <andrew.eager@aes-pl.com.au>, Geoffrey Robertson <ge@ffrey.com> and
  Nick Urbanik <nicku@nicku.org>.
  \par
  Permission is granted to make and distribute verbatim copies or
  modified versions of this document provided that this copyright
  notice and this permission notice are preserved on all copies under
  the terms of the GNU General Public License as published by the Free
  Software Foundation---either version 2 of the License or (at your
  option) any later version.
\end{frame}
\end{document}
