Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

changes to your configuration files. Such tests are important because a
configuration file error can result in your server shutting down when you try
to restart it. There is a bug in the internal username settings for apache2 in


Ubuntu that gives you this error if you enter the following:


Click here to view code image
matthew@seymour:~$ sudo apache2 -t
apache2: bad user name ${APACHE_RUN_USER}


If this happens to you, enter the command this way to force the command to
use the expected username settings, and you will get the proper output:


Click here to view code image
matthew@seymour:~$ sudo APACHE_RUN_USER=www-data
APACHE_RUN_GROUP=www-data apache2 -t


Runtime Server Configuration Settings


At this point, the Apache server will run, but perhaps you want to change a
behavior, such as the default location of your website’s files. This section
covers the basics of configuring the server to work the way you want it to
work.


Runtime configurations are stored in just one file—apache2.conf, which
is under the /etc/apache2 directory. You can use this configuration file to
control the default behavior of Apache, such as the web server’s base
configuration directory (/etc/apache2), the name of the server’s PID file
(/var/run/apache2.pid), or its response timeout (300 seconds).
Apache reads the data from the configuration file when started (or restarted).


Runtime Configuration Directives


You perform runtime configuration of your server with configuration
directives, which are commands that set options for the apache2 daemon.
The directives are used to tell the server about various options you want to
enable, such as the location of files important to the server configuration and
operation. Apache supports nearly 300 configuration directives, using the
following syntax:


Click here to view code image
directive option option...


Each directive is specified on a single line. See the following sections for
some examples of directives and how to use them. A directive may only set a

Free download pdf