Apache HTTP Server Version 2.4
Available Languages: tr
IP-based virtual hosting is a method to apply different directives based on the IP address and port a request is received on. Most commonly, this is used to serve different websites on different ports or interfaces.
In many cases, Name-based vs. IP-based Virtual Hosts to help you decide.
As the term IP-based indicates, the server must have a different IP address/port combination for each IP-based virtual host. This can be achieved by the machine having several physical network connections, or by use of virtual interfaces which are ed by most modern operating systems (see system documentation for details, these are frequently called "ip aliases", and the "ifconfig" command is most commonly used to set them up), and/or using multiple port numbers.
In the terminology of Apache HTTP Server, using a single IP address but multiple T ports, is also IP-based virtual hosting.
There are two ways of configuring apache to multiple hosts. Either by running a separate httpd
daemon for each hostname, or by running a single daemon which s all the virtual hosts.
Use multiple daemons when:
ServerRoot
settings.httpd
could listen to N-1 of the addresses, and another could listen to the remaining address.)Use a single daemon when:
Create a separate Listen
directive in the configuration file to select which IP address (or virtual host) that daemon services. e.g.
Listen 192.0.2.100:80
It is recommended that you use an IP address instead of a hostname (see DNS caveats).
For this case, a single CustomLog
configuration directives to different values for each virtual host. e.g.
<VirtualHost 172.20.30.40:80> Server @www1.example.com DocumentRoot "/www/vhosts/www1" ServerName www1.example.com ErrorLog "/www/logs/www1/error_log" CustomLog "/www/logs/www1/access_log" combined </VirtualHost> <VirtualHost 172.20.30.50:80> Server @www2.example.org DocumentRoot "/www/vhosts/www2" ServerName www2.example.org ErrorLog "/www/logs/www2/error_log" CustomLog "/www/logs/www2/access_log" combined </VirtualHost>
It is recommended that you use an IP address instead of a hostname in the <VirtualHost> directive (see DNS caveats).
Specific IP addresses or ports have precedence over their wildcard equivalents, and any virtual host that matches has precedence over the servers base configuration.
Almost any configuration directive can be put in the VirtualHost directive, with the exception of directives that control process creation and a few other directives. To find out if a directive can be used in the VirtualHost directive, check the directive index.
suEXEC wrapper is used.
SECURITY: When specifying where to write log files, be aware of some security risks which are present if anyone other than the that starts Apache has write access to the directory where they are written. See the security tips document for details.
Available Languages: tr