First, the corresponding a record is determined in DNS, ABC in A 211.154.2.5 Mail in A 211.154.2.5 |
This is about configuring the Apache virtual host under Windows:
One, the configuration of virtual host requires 3 files
1.apache/conf/httpd.conf
2.apache/conf/extra/httpd-vhosts.conf (This ground version of Apache may not have, can be created by itself, or can not be this file,
And the configuration directly written in Httpd.conf, written in extra/httpd-vhosts.conf just for the sake of management convenience, do not let httpd.conf file
A lot of content.)
3.c:\windows\system32\drivers\etc\hosts
①httpd.conf found VirtualHost example, and introduced httpd-vhosts.conf files in the following:
Include conf/extra/httpd-vhosts.conf
This sentence, the high version of Apache has been written in, just the # include the front of the # number to remove the OK
The contents of the ②httpd-vhosts.conf configuration file are as follows:
#
# DocumentRoot is the root directory where the site files are stored
# ServerName is a site domain name that needs to be consistent with DNS-directed domain names
#
#########################################################################################
# http://www.PHPnow.org
# filename:httpd-vhosts.conf
< Directory : /vhosts>
AllowOverride All
Order Allow,deny
Allow from all
</ Directory >
Namevirtualhost *
< VirtualHost *>
DocumentRoot. /htdocs
ServerName default:80
Errorlog Logs/default-error_log
</ VirtualHost >
#<VirtualHost *>
# ServerAdmin [email protected]
# DocumentRoot "D:/htdocs/lxcms"
# ServerName cms.weixinyixia.com:80
# Serveralias cms.weixinyixia.com
# Errorlog Logs/cms.weixinyixia.com-error_log
#</VirtualHost>
======================================================= The following is just a reference to other ways ~============================================= ==========================
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
Namevirtualhost *:80
< VirtualHost *:>
Documentroot/www/deerol_com
ServerName www.deerol.com
# Other Directives here
#配置域名的目录访问权限
< Directory "/www/deerol_com">
Options Indexes FollowSymLinks
Allow from all
</ Directory >
</ VirtualHost >
< VirtualHost *:>
Documentroot/www/163_com
ServerName www.163.com
# Other Directives here
#配置域名的目录访问权限
< Directory "/www/deerol_com">
Options Indexes FollowSymLinks
Allow from all
</ Directory >
</ VirtualHost >
The first item in the above setting (that is,ServerName www.deerol.com)是默认选项。若用户访问所指定的域名不符合所有条目时采用默认项,即指向
www.deerol.com。
Scenarios that you might encounter when configuring:
1. Using domain name plus port access
If you need to have port access (this is a rare scenario, it is typically used during testing) such as: www.domain.com:8081 at this point, after configuring <VirtaulHost>, you also need to add a listener to the port listen 8081
2. If IIS (running the Asp,asp.net program) is installed on the server in addition to the Apache service, how is the Tomcat (run java,jsp program) service configured?
In general we will default to Apache 80 port, IIS can be set to 81 port, Tomcat is set to 8080 port. Suppose there is a JSP program that we can access through Http://localhost:8080/document when the server is configured locally. How to configure access to this address through the domain name?
< VirtualHost *:>
Proxypreservehost on
ServerName yourdomain.com
DirectoryIndex index.jsp
proxypass/http://localhost:8080/kboom/
proxypassreverse/http://localhost:8080/kboom/
</ VirtualHost >
Here we notice the use of proxy access. First turn on agent support Proxypreservehost on, then configure forward proxy and reverse proxy proxypass/http://localhost:8080/kboom (kboom as virtual directory)
< excerpt from: http://blog.sina.com.cn/s/blog_75ad10100101m5q6.html & http://blog.csdn.net/zhanglei5415/article/details/6821066 >
Apache, the same IP uses multiple domain names to correspond to several Web sites method