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

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

更新时间:2012年03月11日 00:28:19   作者:

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:\InterRoot\billing_new\front"

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

相关文章

1a1b05c64693fbf380aa1344a7812747.png

这篇文章主要介绍了apache下面二级目录部署react/vue的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2018-08-08

4f55910a645b073bc4fc65dc10dc14bd.png

这篇文章主要介绍了Linux 添加开机启动方法(服务/脚本),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2019-12-12

0ea3c7666119d5615e582f823fb3fad6.png

本篇文章主要介绍了Linux定时任务Crontab详解,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。2016-12-12

4f96a78db829b1556ff16de21e013c7a.png

这篇文章主要介绍了如何优雅地删除 Linux 中的垃圾文件的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧2020-03-03

8cc1031babc6aff2319f1c6af8544aa0.png

这篇文章主要介绍了linux Bash脚本判别使用者的身份方法示例,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2019-01-01

0c932a99bb7b6f23c937db507070cc7b.png

这篇文章主要介绍了关于linux中ssh超时自动登出时间的设置方法,以避免总是被强行退出。需要的朋友可以参考借鉴,下面来一起看看吧。2017-02-02

cca732bf65a93ed2ec0ac80c638460fe.png

LAMP服务器性能优化技巧之Linux主机优化:由于LAMP的发展迅速,如今LAMP已经成为Web服务器的标准。如何才能优化LAMP服务器的性能?2012-02-02

2d9f31f2af7b675a3d153d2b7f1035a7.png

Sysctl指令是对系统核心参数的设置,下面这篇文章主要给大家介绍了关于Linux利用Sysctl命令调整内核参数的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面随着小编来一起学习学习吧。2018-01-01

b452cee8ec5cd9e58ab98eba17281e59.png

一般来说,对 Linux 系统的安全设定包括取消不必要的服务、限制远程存取、隐藏重要资料、修补安全漏洞、采用安全工具以及经常性的安全检查等,本文为大家分享Linux/CentOS服务器安全配置的通用方案2018-10-10

f4838ec7e2d4da28e0b57d4e852dadd4.png

这篇文章主要介绍了ubuntu下kvm 命令行安装64位ubuntu报"Couldn't find hvm kernel for Ubuntu tree."的问题分析的相关资料,需要的朋友可以参考下2016-11-11

最新评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值