The Apache HTTP Server, colloquially called Apache, is the world's most widely used web server software. Originally based on the NCSA HTTPd server, development of Apache began in early 1995 after work on the NCSA code stalled. Apache played a key role in the initial growth of the World Wide Web, quickly overtaking NCSA HTTPd as the dominant HTTP server, and has remained the most popular HTTP server since April 1996. In 2009, it became the first web server software to serve more than 100 million websites.1
Table of contents
References
Installation
- How to install Apache, PHP 7.2 and MySQL on CentOS 7.4 (LAMP)
- Install Apache2, MariaDB, and PHP 7.1 (LAMP) on Ubuntu 16.04 LTS Server
- Ubuntu 18.04 (LTS) LAMP server tutorial with Apache, PHP 7.2, and MySQL
Virtual Host
The term Virtual Host refers to the practice of running more than one web site (such as company1.example.com and company2.example.com) on a single machine. Virtual hosts can be "IP-based", meaning that you have a different IP address for every web site, or "name-based", meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user.2
<VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "\var\www\mydomain" ServerName mydomain.dev ServerAlias www.mydomain.dev ErrorLog "logs/dummy-host.mydomain.dev-error.log" CustomLog "logs/dummy-host.mydomain.dev-access.log" common </VirtualHost>
<VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "/var/www/mydomain" ServerName mydomain.dev ServerAlias www.mydomain.dev <Directory /var/www/mydomain> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> ErrorLog "logs/dummy-host.mydomain.dev-error.log" CustomLog "logs/dummy-host.mydomain.dev-access.log" common </VirtualHost>
Upgrade Apache 2.2 to Apache 2.4
- https://httpd.apache.org/docs/2.4/upgrading.htmlUpgrading to 2.4 from 2.2
- Updating Virtual Host Settings from Apache 2.2 to Apache 2.4
- How To Migrate your Apache Configuration from 2.2 to 2.4 Syntax.
Configure Apache to use the Signed SSL/TLS Certificates
The Apache HTTP Server module mod_ssl provides an interface to the OpenSSL library, which provides Strong Encryption using the Secure Sockets Layer and Transport Layer Security protocols.3
<VirtualHost 12.34.56.78:443> SSLEngine On SSLCertificateFile /etc/apache2/ssl/www.mydomain.com.crt SSLCertificateKeyFile /etc/apache2/ssl/www.mydomain.com.key SSLCACertificateFile /etc/apache2/ssl/verisign.cer ServerAdmin info@mydomain.com ServerName www.mydomain.com DocumentRoot /srv/www/mydomain.com/public_html/ ErrorLog /srv/www/mydomain.com/logs/error.log CustomLog /srv/www/mydomain.com/logs/access.log combined </VirtualHost>