apache 配置虚拟机应用服务
apache可以通过自己配置自己的虚拟机来实现负载均衡。可以适用于一台机器配置有两张网卡,或是多个域名,可以通过采用 APACHE的自己的虚拟机实现。
首先配置httpd.conf
将#Include conf/extra/httpd-vhosts.conf前面的#号去掉,打开虚拟主机配置;
然后配置:
Apache2.2\conf\extra\httpd-vhost.conf
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
Listen 10063
<VirtualHost 192.168.50.1:10063>
ServerAdmin webmaster@host.foo.com
DocumentRoot "D:/WepApps/10063/"
ErrorLog logs/10063_error_log
CustomLog "logs/10063_access_log" combined
<Directory "D:/WepApps/10063/">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Listen 10064
<VirtualHost 192.168.50.2:10064>
ServerAdmin webmaster@host.foo.com
DocumentRoot "D:/JS/jslibs"
ErrorLog logs/10064_error_log
CustomLog "logs/10064_access_log" combined
<Directory "D:/JS/jslibs/">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
通过这样的配置,可以实现对两个项目的访问。
页:
[1]