Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1
%r—The  first   line    of  request.
%s—Status. For requests that were internally redirected, this is the status
of the original request (%>s for the last).
%t—The time, in common log time format.
%{format}t—The time, in the form given by format.
%T—The seconds taken to serve the request.
%u—The remote user from auth; this might be bogus if the return status
(%s) is 401.
%U—The URL path requested.
%V—The server name according to the UseCanonicalName directive.
%v—The canonical ServerName of the server serving the request.

You can put a conditional in front of each variable to determine whether the
variable is displayed. If the variable isn’t displayed, - is displayed instead.
These conditionals are in the form of a list of numerical return values. For
example, %!401u displays the value of REMOTE_USER unless the return
code is 401.


You can then specify the location and format of a log file using the
CustomLog directive:


Click here to view code image
CustomLog logs/access_log common


If it is not specified as an absolute path, the location of the log file is assumed
to be relative to the ServerRoot.


HTTPS


The mod_ssl module listed above gives Apache2 the ability to encrypt
communications using OpenSSL. This means is your website can be accessed
using https:// instead of just http://, and all communications to and from the
site will be encrypted. The module is included in the main apache2-
common package, so if you installed that from the Ubuntu repositories when
you installed Apache, you don’t have to install additional apache packages.


Enter the following to enable the mod_ssl module:


Click here to view code image

Free download pdf