Web Services: Configuring a Virtual Host on Apache

10 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Apache Virtual Hosts are used when you want to host multiple websites on a single server. It’s useful to lower your server footprint and to make better use of the available hardware. In this lab you’ll be able to work with different methods of declaring Virtual Hosts.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Configure and test an IP based virtual host using port 80.
  1. Since we’re configuring Apache, let’s elevate to root.
  2. Remove the Listen configuration option from /etc/httpd/conf/httpd.conf.
  3. Create a new file in /etc/httpd/conf.d/DadCorp.conf that contains permission for Apache to access the /opt directory, and the VirtualHost definition.
  4. Restart Apache and verify your configurations work.
Configure and test an IP based virtual host using port 8080.
  1. Modify the /etc/httpd/conf.d/DadCorp.conf file to include a new Listen directive with the correct port.
  2. Set up a new VirtualHost definition that includes the right port.
  3. Restart Apache and verify your configurations work.

Additional Resources

You have just started working at DadCorp, a new startup providing a subscription service that emails dad jokes to customers. The majority of the data center is web servers containing the sign-up forms.

DadCorp is expanding, and needs to revamp its infrastructure. As part of doing so they're changing the setup of their webservers to use VirtualHosts instead of just using the main Apache DocumentRoot.

Set up an Apache VirtualHost to use /opt/website as the DocumentRoot using an IP based VirtualHost, with the a server name of www.dadcorp.com.

Once that is complete you receive a second ticket. To enable testing with some new load balancers, another VirtualHost is needed. It should be identical to the first, but run on port 8080 instead.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!