Configuring name-based virtual hosting

As you may recall from our discussions surrounding DNS in Chapter 8, Managing Domains and DNS a user's browser needs to translate a website's hostname to its IP address via DNS lookups before it can connect and retrieve the desired web content. You may also recall that this doesn't have to be a one-to-one mapping-more than one site can resolve to the same IP address. Apache is flexible enough so that the same server can serve more than one site by a configuration known as name-based virtual hosting.

This recipe teaches you how to set up name-based virtual hosting. Each site has it's own configuration (often kept in its own configuration file for better organization). Based on the site name that appears in ...

Get CentOS 7 Server Deployment Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.