栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > 服务器

Apache虚拟主机的配置和泛域名解析实现代码

服务器 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Apache虚拟主机的配置和泛域名解析实现代码

虚拟主机的配置
  基于IP地址的虚拟主机配置
  Listen 80
  documentRoot /www/jb51
  ServerName www.jb51.net
  documentRoot /www/jb512
  ServerName www.jb512.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/jb51-80
  ServerName www.jb51.net
  documentRoot /www/jb51-8080
  ServerName www.jb51.net
  documentRoot /www/example2-80
  ServerName www.jb51.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/jb51
  ServerName www.jb51.net
  ServerAlias jb51.net. *.jb51.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/jb51
  ServerName www.jb51.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.jb51.net
  documentRoot /www/domain-80
  ServerName www.jb51.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/jb51
  ServerName www.jb51.net
  documentRoot /www/example2
  ServerName www.example2.org
  documentRoot /www/example3
  ServerName www.example3.net
  网站泛域名解析
  添加一个虚拟主机配置(如下):
  
  documentRoot d:/web/jb51 # 网站根目录的绝对路径
  ServerName www.jb51.net # 网站域名
  ServerAlias *.jb51.net # 网站泛域名

APACHE泛域名配置参考

NameVirtualHost 192.168.0.110


documentRoot "E:/InterRoot/workplace/"
ServerName www.workplace.com

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




documentRoot "E:/InterRoot/busymouse_test/"
ServerName www.test.com

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




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"

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




documentRoot "E:/InterRoot/iptv_for_browser/api"
ServerName voiz.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




documentRoot "E:/InterRoot/iptv_for_browser/user"
ServerName user.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




documentRoot "E:/InterRoot/iptv_for_browser/center"
ServerName center.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




documentRoot "E:/InterRoot/iptv_for_browser/img"
ServerName img.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




documentRoot "E:/InterRoot/iptv_for_browser/log"
ServerName log.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all




documentRoot "E:InterRootbilling_newfront"
ServerName admin.billing.com
ErrorLog "E:/InterRoot/iptv_for_browser/serverlog/apache.log"

AllowOverride FileInfo
Options Indexes FollowSymlinks Includes
Order allow,deny
Allow from all

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/184749.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号