How To Securely Manage Secrets with HashiCorp Vault on Ubuntu 16.04


The Apache internet host is an open-source internet host popular because of its freedom, energy, and support that is widespread. In this guide, we’ll go over some procedures that are common handling the Apache host, including stopping, beginning, and allowing the solution, using digital host files and directories, and finding essential files and directories on your own host.

This guide is oriented around users using Apache on Ubuntu. Users taking care of CentOS as well as other distributions that are RHEL-based take a look at part one within guide for details about setting up Apache on CentOS.

How To Make Use Of This Guide:

  • Each part can be utilized individually of other people, therefore take a moment to skip to parts which can be strongly related your preferences.
  • Each demand is self-contained, enabling you to supercede your values that are own those in red.
  • Each part has connected resources, which you yourself can consult to learn more about covered subjects.

Installing the Apache Provider

To install the Apache solution, improve your package indexes, install:( then*****)

  • sudo apt-get improvement
  • sudo apt-get apache2 that is install

For more information regarding the installation procedure, follow our guide on how best to Install the Apache Web Server on Ubuntu 16.04.

Enabling and Disabling the Apache Unit

Our Apache solution is configured to begin immediately at boot. We could type the following: ( if we wanted to modify this behavior, however,*****)

  • sudo systemctl apache2.service that is disable

To enable Apache to begin up once again at boot:

  • sudo systemctl permit apache2.service

Stopping, Beginning, and Reloading Apache

To stop the Apache host, kind the command that is following*****)

  • sudo systemctl stop apache2

To begin the Apache host, kind:

  • sudo systemctl begin apache2

To stop the solution and again start it, kind:

  • sudo systemctl restart apache2

(you can reload Apache without dropping connections****)If you are making configuration changes. Type the command that is following*****)

  • sudo systemctl reload apache2

To find out more about the systemd init system as well as the systemctl demand, check always this introduction out to systemd basics.

Checking the Server Reputation

To check out the status of one’s Apache host, kind:

  • sudo systemctl status apache2

The production using this demand will inform you whether Apache is operating, and can explain to you the very last lines that are few the log files.

Creating a Document Root Directory for a Static Website

when utilizing Apache to construct sites, designers usually use virtual hosts—units that comprise person internet sites or domain names. This procedure involves producing a directory the document root, the top-level directory Apache checks whenever content that is serving.

Create the directory:

  • sudo mkdir/var/www/ that are-p***********************)

Assign ownership associated with directory towards user that is non-root:

  • sudo chown -R $CONSUMER:$CONSUMER /var/www/

Allow browse usage of the web directory:( that is general*****)

  • sudo find /var/www -type d -exec chmod 775 {} ;

For more about permissions, see our introduction to Linux permissions. Take into account that your permissions may alter together with your requirements and make use of situations.

Creating a Document Root Directory for Dynamic Processing Modules

(you will create your document root directory as follows:

If you are working with a dynamic processing module like PHP,*****)

  • sudo mkdir/var/www/ that are-p***********************)

Assign ownership associated with directory towards non-root individual, and team ownership toward www-data team:

  • sudo chown -R sammy:www-data /var/www/

Modifying Setup Settings

whenever using digital hosts, it’s important to change setup settings to mirror domain details, to ensure that Apache can react precisely to domain demands.

Open your host that is virtual configuration:

  • sudo nano***********************) that is/etc/apache2/sites-available

Modify the ( that is following*****)

ServerAdmin [email protected]
DocumentRoot /var/www/

With customizations, the file should seem like this (supplied it offers perhaps not been modified before):


<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

whenever troubleshooting, make sure to check this file as well as its directives.

For increased detail about using digital hosts, see our conversation on using Apache hosts that are virtual Ubuntu 16.04.

Enabling and configuration that is disabling

Virtual Host Data

To permit digital host setup files:

  • sudo a2ensite

To disable setup files (within specific instance, the Apache standard digital host setup file):

  • sudo a2dissite 000-default.conf


To allow the modules present in /etc/apache2/mods-available, make use of the after demand:

To disable a module:( that is specific*****)

  • sudo a2dismod example_mod

Configuration Data

To allow the setup files in /etc/apache2/conf-available—files perhaps not connected with digital hosts—type:

  • sudo a2enconf example-conf

To disable a setup file:

  • sudo a2disconf example-conf

Configuration Testing

Any time you make modifications to setup files in Apache, make sure to run the command that is following search for syntax mistakes:

  • sudo apache2ctl configtest

Important Data and Directories

As you keep up using Apache, you will come across the directories that are following files:


  • /var/www/html: This directory holds the net content of one's website, and it is its standard root. You are able to change Apache’s standard setup settings to point out other directories within var/www.

Server Configuration

  • /etc/apache2: The setup directory in Apache, house to all or any of its setup files.

  • /etc/apache2/apache2.conf: Apache’s main setup file, which stores its worldwide setup settings. Other files in setup directory are packed using this file. It stores the FollowSymLinks directives, which control setup allowing and disabling.

  • /etc/apache2/sites-available/: This directory holds host that is virtual files, that are enabled through links toward sites-enabled directory. Modification to server block files takes place within directory, and it is enabled through a2ensite demand.

  • /etc/apache2/sites-enabled/: Activated digital host setup files are kept right here. Whenever Apache begins or reloads, it checks out the setup files and links within directory because it complies a configuration that is full

  • /etc/apache2/conf-available and /etc/apache2/conf-enabled: in identical relationship as sites-available and sites-enabled, these directories household setup fragments which can be unattached to digital host setup files.

  • /etc/apache2/mods-available and /etc/apache2/mods-enabled: Containing modules that are offered and enabled, these directories have actually two elements: files closing in .load, that have fragments that load specific modules, and files closing in .conf, which shop the designs among these modules.

Server Logs

  • /var/log/apache2/access.log: Every request is contained by this file toward internet host unless Apache’s setup settings were modified.

  • /var/log/apache2/error.log: This file contains mistakes. To change the quantity of information in mistake logs, change the LogLevel directive in /etc/apache2/apache2.conf.

Another method to access details about the Apache device is through journald component, which gathers log information from applications as well as the kernel. To see entries the Apache device, kind:

  • sudo journalctl -u apache2


In this guide, we’ve covered some procedures that are common managing the Apache server, including stopping, starting, and enabling the service, working with virtual host files and directories, and locating important files and directories on your server. To learn more about working with Apache, take a look at the resources that are following*****)

Vulkan is visiting macOS and iOS, but no because of Apple

Previous article

Let us Encrypt SSL On Vestacp: easiest method

Next article

You may also like


Leave a Reply

More in Apache