Red Hat LINUX 7.2 Reference Manual page 220

Hide thumbs Also See for LINUX 7.2:
Table of Contents

Advertisement

220
To create a virtual host, you will need to alter the virtual host lines, provided as an example, in
httpd.conf, or create your own virtual host section. (Remember that name-based virtual hosts
will not work with your secure server — you will need to use IP address-based virtual hosts if you
need SSL-enabled virtual hosts. Your non-secure server, however, will support both IP address and
name-based virtual hosts.)
The virtual host example lines read as follows:
#<VirtualHost ip.address.of.host.some_domain.com>
#
ServerAdmin webmaster@host.some_domain.com
#
DocumentRoot /www/docs/host.some_domain.com
#
ServerName host.some_domain.com
#
ErrorLog logs/host.some_domain.com-error_log
#
CustomLog logs/host.some_domain.com-access_log common
#</VirtualHost>
Uncomment all of the lines. Then add the correct information for your machine and/or your virtual
host to each line.
In the first line, change ip.address.of.host.some_domain.com to your server's IP address.
Change the ServerName to a valid DNS name to use for the virtual host. (In other words, do not
just make something up. Ask your system administrator if you do not know how to get a valid domain
name.)
You will also need to uncomment one of the NameVirtualHost lines in httpd.conf:
#NameVirtualHost 12.34.56.78:80
#NameVirtualHost 12.34.56.78
Uncomment one of the lines and change the IP address to the IP address (and port if necessary) for
that virtual host.
Many other configuration directives can be placed between the virtual host tags, depending upon why
you are setting up a virtual host.
If you set up a virtual host and want it to listen on a non-default port (80 is the default port for non-
secure Web communications; 443 is the default port for secure Web communications), you will need
to set up a virtual host for that port and add a Listen directive to httpd.conf, corresponding to
that port.
To have a virtual host work specifically for that port, add the port number to the first line of the virtual
host configuration. The first line should look something like the following:
<VirtualHost ip_address_of_your_server:12331>
This line would create a virtual host that listens on port 12331. Substitute the port number you want
to use for 12331 in the previous example.
Chapter 13:Apache

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the LINUX 7.2 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Linux 7.2

Table of Contents