Apache虚拟主机的配置和泛域名解析实现代码(apache基于域名虚拟主机配置)

Apache虚拟主机的配置和泛域名解析实现代码(apache基于域名虚拟主机配置)

扫码添加渲大师小管家,免费领取渲染插件、素材、模型、教程合集大礼包!

虚拟主机的配置
  基于IP地址的虚拟主机配置
  Listen 80
  DocumentRoot /www/zz
  ServerName www.zz.net
  DocumentRoot /www/zz2
  ServerName www.zz2.org
  基于IP和多端口的虚拟主机配置
  Listen 172.20.30.40:80
  Listen 172.20.30.40:8080
  Listen 172.20.30.50:80
  Listen 172.20.30.50:8080
  DocumentRoot /www/zz-80
  ServerName www.zz.net
  DocumentRoot /www/zz-8080
  ServerName www.zz.net
  DocumentRoot /www/example2-80
  ServerName www.zz.org
  DocumentRoot /www/example2-8080
  ServerName www.example2.org
  单个IP地址的服务器上基于域名的虚拟主机配置:
  # Ensure that Apache listens on port 80
  Listen 80
  # Listen for virtual host requests on all IP addresses
  NameVirtualHost *:80
  DocumentRoot /www/zz
  ServerName www.zz.net
  ServerAlias zz.net. *.zz.net
  # Other directives here
  DocumentRoot /www/example2
  ServerName www.example2.org
  # Other directives here
  在多个IP地址的服务器上配置基于域名的虚拟主机:
  Listen 80
  # This is the “main” server running on 172.20.30.40
  ServerName server.domain.com
  DocumentRoot /www/mainserver
  # This is the other address
  NameVirtualHost 172.20.30.50
  DocumentRoot /www/zz
  ServerName www.zz.net
  # Other directives here …
  DocumentRoot /www/example2
  ServerName www.example2.org
  # Other directives here …
  在不同的端口上运行不同的站点:
  基于多端口的服务器上配置基于域名的虚拟主机。
  Listen 80
  Listen 8080
  NameVirtualHost 172.20.30.40:80
  NameVirtualHost 172.20.30.40:8080
  ServerName www.zz.net
  DocumentRoot /www/domain-80
  ServerName www.zz.net
  DocumentRoot /www/domain-8080
  ServerName www.example2.org
  DocumentRoot /www/otherdomain-80
  ServerName www.example2.org
  DocumentRoot /www/otherdomain-8080
  基于域名和基于IP的混合虚拟主机的配置:
  Listen 80
  NameVirtualHost 172.20.30.40
  DocumentRoot /www/zz
  ServerName www.zz.net
  DocumentRoot /www/example2
  ServerName www.example2.org
  DocumentRoot /www/example3
  ServerName www.example3.net
  网站泛域名解析
  添加一个虚拟主机配置(如下):
  
  DocumentRoot d:/web/zz # 网站根目录的绝对路径
  ServerName www.zz.net # 网站域名
  ServerAlias *.zz.net # 网站泛域名

APACHE泛域名配置参考

NameVirtualHost 192.168.0.110

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/workplace/"
ServerName www.workplace.com
<Directory "E:/InterRoot/workplace/">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/busymouse_test/"
ServerName www.test.com
<Directory "E:/InterRoot/busymouse_test/">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/iptv_for_browser/auth"
ServerName auth.billing.com
ServerAlias auth.billing.com *.auth.billing.com
#泛域名解析
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"
<Directory "E:/InterRoot/iptv_for_browser/auth">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/iptv_for_browser/api"
ServerName voiz.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"
<Directory "E:/InterRoot/iptv_for_browser/api">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/iptv_for_browser/user"
ServerName user.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"
<Directory "E:/InterRoot/iptv_for_browser/user">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/iptv_for_browser/center"
ServerName center.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"
<Directory "E:/InterRoot/iptv_for_browser/center">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/iptv_for_browser/img"
ServerName img.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"
<Directory "E:/InterRoot/iptv_for_browser/img">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:/InterRoot/iptv_for_browser/log"
ServerName log.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"
<Directory "E:/InterRoot/iptv_for_browser/log">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.110:80>
DocumentRoot "E:\InterRoot\billing_new\front"
ServerName admin.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"
<Directory "E:\InterRoot\billing_new\front">
AllowOverride FileInfo
Options Indexes FollowSymLinks Includes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

分享到 :
相关推荐

虚拟主机和虚拟服务器有什么区别(虚拟主机和虚拟服务器有什么区别呢)

1。概念不同虚拟服务器是指采用特殊的软硬件技术把一台完整的服务器主机分成若干个主机[...

wamp5是什么 wamp有什么用途(wamp具体指的是什么)

要弄清楚wamp5是什么?有什么用途?我们得先弄清楚wamp网站环境了。之前我们也有...

免备案vps国内(免备案vps排行)

有建站经验的朋友应该都知道,使用国内服务器来搭建网站,是需要按照相关程序进行备案的。...

这几个问题,租用香港主机必须留意(这几个问题,租用香港主机必须留意什么)

挑选主机是做网站务必面对的问题。非常是面对各种各样互联网安和有关事后问题。主机的挑选...

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注