apache多域名绑定

用记事本打开appache下面的httpd.conf文件

示例如下:
#NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin [email protected]
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

#号是起注释作用的
实例
NameVirtualHost 203.171.228.123:80

<VirtualHost 203.171.228.123:80> //ip及端口
ServerAdmin [email protected] //管理邮箱地址
DocumentRoot E:\asd //绑定的目录
ServerName www.pdsying.com //绑定的域名
ErrorLog logs/pds-error_log //错误的日志
CustomLog logs/pds_log common //客户日志
</VirtualHost>

<VirtualHost 203.171.228.123:80>
ServerAdmin [email protected]
DocumentRoot E:\asd\abc
ServerName vps.okboss.cn
ErrorLog logs/okboss.cn-error_log
CustomLog logs/okboss.cn-access_log common
</VirtualHost>

<VirtualHost 203.171.228.123:80>
ServerAdmin [email protected]
DocumentRoot E:\asd\abc\a
ServerName a.okboss.cn
ErrorLog logs/a-error_log
CustomLog logs/a_log common
</VirtualHost>
要绑定多少个域名,就添加多少个<VirtualHost></VirtualHost>记录
完毕!

你可能感兴趣的:(apache,多域名绑定)