apache2 - testing if the VirtualHost is working

5 points
Created by:

In this short article we would like to show how to check with curl command if VirtualHost is working under Apache2 server correctly.

Presented approach uses fact, if we have set many domains under one apache2 instance, we can send Host: header that switches between domains under same server.

Note: check if curl is installed - you can use Windows or Linux Bash.

Run following command:

curl '' -H 'Host:' --compressed --insecure


  • should be replaced with your server ip address of machine with apache2,
  • should be replaced with domain configured in VirtualHost.

Example output:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.8, user-scalable=yes">
<title>Welcome on my page!</title>


Apache2 configuration

Example /etc/apache2/sites-enabled/ file content:

<VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass /
        ProxyPassReverse /
Native Advertising
50 000 ad impressions - 449$
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂