Default virtual host
By default, Apache is configured with a single default virtual host which can be modified or used as-is if you have a single site, or used as a template for additional virtual hosts if you want to have multiple sites. The configuration file that contains configuration directives for the default Web server is /etc/apache2/sites-available/000-default.conf:
As you can see from the picture above, this configuration file contains the VirtualHost block with several directives:
- <VirtualHost *:80> – specifies that the web server will listen on the port 80 for all IP addresses on the system.
- ServerAdmin webmaster@localhost – specifies the email address to be displayed for the server’s administrator. If your website has a problem, Apache will display an error message with this email listed as contact.
- DocumentRoot /var/www/html – specifies where Apache will look for the files that make up the website.
- ErrorLog ${APACHE_LOG_DIR}/error.log – specifies the location of the error log.
- CustomLog ${APACHE_LOG_DIR}/access.log combined – specifies the location of the access log and the log display format.
- </VirtualHost> – specifies the end of the VirtualHost block.
The default Document root is set to /var/www/html/. In Ubuntu, this directory contains an example HTML file:
If your Apache web server is running with the default settings, you can launch your browser and go to http://localhost:80 to dispay the content of this file: