This post describes to configure two VirtualHost in apache, one is simple domain pointing, another one configure subdomain with reverse proxy.

 A reverse proxy is a gateway for servers, and enables one web server to provide content from another transparently.this is helpful to improve connection performance of the web by caching; this is a simple way to mirror a website.

Create a DocumentRoot directory for domain, 

# mkdir -p /home/thelinuxfaq/public_html

open your apache2.conf file and append the below lines,

# vim /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /home/thelinuxfaq/public_html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


Create a new VirtualHost for a subdomain with and configure reverse proxy. 

The above VirtualHost configuration enough for default modules, If you would like to configure reverse proxy required necessary apache modules for this.

Install necessary packages,

# aptitude    update

# aptitude -y upgrade

# aptitude install -y build-essential

# aptitude install -y libapache2-mod-proxy-html libxml2-dev

Create a DocumentRoot directires for subdomain,

# mkdir -p /home/thelinuxfaq/proxy

mod_proxy: This is a  proxy module for Apache that manages connections and redirects them.

modproxyhttp: This module implements the proxy features for both HTTP and HTTPS protocols.

If you could not found the modules just install necessary 

# a2enmod proxy_http

# a2enmod rewrite

# a2enmod proxy

# apache2ctl -M

Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)

 Another option is to enable Apache specific modules,

​# a2enmod

Your choices are: access_compat actions alias allowmethods asis auth_basic auth_digest auth_form authn_anon authn_core authn_dbd authn_dbm authn_file authn_socache authnz_ldap authz_core authz_dbd authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex buffer cache cache_disk cache_socache cgi cgid charset_lite data dav dav_fs dav_lock dbd deflate dialup dir dump_io echo env expires ext_filter file_cache filter headers heartbeat heartmonitor include info lbmethod_bybusyness lbmethod_byrequests lbmethod_bytraffic lbmethod_heartbeat ldap log_debug log_forensic lua macro mime mime_magic mpm_event mpm_prefork mpm_worker negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_express proxy_fcgi proxy_fdpass proxy_ftp proxy_html proxy_http proxy_scgi proxy_wstunnel ratelimit reflector remoteip reqtimeout request rewrite sed session session_cookie session_crypto session_dbd setenvif slotmem_plain slotmem_shm socache_dbm socache_memcache socache_shmcb speling ssl status substitute suexec unique_id userdir usertrack vhost_alias xml2enc
Which module(s) do you want to enable (wildcards ok)?
Considering dependency proxy for proxy_ajp:
Module proxy already enabled
Enabling module proxy_ajp.
To activate the new configuration, you need to run:
  service apache2 restart

The configuration file is,

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /home/thelinuxfaq/proxy

    #Reverse proxy set
        ProxyPass /  retry=0 timeout=5
        ProxyPassReverse / 

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


Finally, restart the Apache service,

# service apache2 restart