【转】Apache虚拟主机的配置和泛解析域名的绑定
基于IP地址的虚拟主机配置
Listen 80
DocumentRoot /www/example1
ServerName www.example1.com
DocumentRoot /www/example2
ServerName www.example2.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/example1-80
ServerName www.example1.com
DocumentRoot /www/example1-8080
ServerName www.example1.com
DocumentRoot /www/example2-80
ServerName www.example1.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/example1
ServerName www.example1.com
ServerAlias example1.com. *.example1.com
# 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/example1
ServerName www.example1.com
# 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.example1.com
DocumentRoot /www/domain-80
ServerName www.example1.com
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/example1
ServerName www.example1.com
DocumentRoot /www/example2
ServerName www.example2.org
DocumentRoot /www/example3
ServerName www.example3.net
网站泛域名解析
添加一个虚拟主机配置(如下):
DocumentRoot d:/web/server110.com # 网站根目录的绝对路径
ServerName www.server110.com # 网站域名
ServerAlias *.server110.com # 网站泛域名
原文地址:http://www.server110.com/apache/201310/2783.html
【转】Apache虚拟主机的配置和泛解析域名的绑定的更多相关文章
- apache 虚拟主机详细配置:http.conf配置详解
apache 虚拟主机详细配置:http.conf配置详解 Apache的配置文件http.conf参数含义详解 Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd. ...
- Apache虚拟主机的配置
虚拟主机的配置 基于IP地址的虚拟主机配置Listen 80DocumentRoot /www/example1ServerName www.example1.comDocumentRoot /www ...
- Apache虚拟主机(vhost)配置教程
使用apache来配置虚拟主机,在单一系统上运行多个网站. 现在很多linux主机使用apache作为web服务器的,大部分是基于这个原理来配置虚拟主机的. 下面就windows下以apache 2. ...
- Apache 虚拟主机 VirtualHost 配置
虚拟主机 (Virtual Host) 是在同一台机器搭建属于不同域名或者基于不同 IP 的多个网站服务的技术. 可以为运行在同一物理机器上的各个网站指配不同的 IP 和端口, 也可让多个网站拥有不同 ...
- Windows下Apache 虚拟主机 VirtualHost 配置
以下方式适合原生 Apache, XAMPP 和 WAMP 套件 1.修改Apache配置文件(httpd.conf),如下: # Virtual hostsInclude conf/extra/ht ...
- Apache虚拟主机&伪静态配置
Apache基本操作 安装:yum install httpd 启动:systemctl start httpd 查看进程:ps -ef | grep httpd 查看端口:sudo netstat ...
- apache 虚拟主机的配置
一.基于IP 1. 假设服务器有个IP地址为192.168.1.10,使用ifconfig在同一个网络接口eth0上绑定3个IP: [root@localhost root]# ifconfig et ...
- Nginx 虚拟主机 VirtualHost 配置
Nginx 是一个轻量级高性能的 Web 服务器, 并发处理能力强, 对资源消耗小, 无论是静态服务器还是小网站, Nginx 表现更加出色, 作为 Apache 的补充和替代使用率越来越高. 我在& ...
- apache虚拟主机设置泛域名的方法
在apache虚拟主机中设置泛域名解析,主要是用到ServerAlias 的配置. 1.支持多域名 例如,让mail.jbxue.org.smtp.jbxue.org.pop3.jbxue.org 都 ...
随机推荐
- 用ACE来写代码
写在前面 在很多时候,我们想用一个支持高亮的WEB编辑器来做规则配置.代码编辑等,此时ACE应该是一个不错的选择,简单的用法如下: <!DOCTYPE html> <html lan ...
- stylus使用文档总结:选择器+变量+插值+运算符+混合书写+方法
建立好项目后我们来安装stylus npm install stylus stylus-loader --save-dev 这样就安装上了stylus. 接下来就可以使用了,使用方式分两种.一种是在. ...
- 解决AJAX跨域:1、利用JSONP;2、JS设置Header
一.利用JSONP: 首先来看看在页面中如何使用jQuery的ajax解决跨域问题的简单版: $(document).ready(function(){ var url='http://localho ...
- Maven+SpringMVC+Mybatis整合入门Demo
1 数据库准备 (1)建立一个名为mytest的数据库 (2)创建表 CREATE TABLE `t_user` ( `USER_ID` int(11) NOT NULL AUTO_INCREMENT ...
- 将EC2的Sql Server 计划任务的方式备份到s3上
编写个powershell脚本 $server = '.' $database = 'databaseName' $s3Bucket = 's3bucket' $backupPath = 'D:\Ba ...
- Spring 自定义配置类bean
<!-- 引入配置文件 --> <bean id="propertyConfigurer" class="org.springframework.bea ...
- EffectiveJava(29)优先考虑类型安全的异构容器
当你的泛型集合需要更多的灵活性,你可以将键进行参数化而不是将容器进行参数化.然后将参数化的键提交给容器,来插入或者获取值.用泛型系统来确保值得类型与它的键相符. 我们创建一个Favorite类来模拟这 ...
- SonarQube install on Kubernetes
Sonarqube搭建代码 apiVersion: extensions/v1beta1 kind: Deployment metadata: name: postgres labels: app: ...
- thinkphp 表名 大小写 窍门
我们有一个表auth_group_access,那么如何使用呢?在使用M方法时,对于带下划线的表名,可以采用如下方法. M('AuthGroupAccess');对应sql语句SQL: SHOW CO ...
- 《暗黑世界V1.3》数据库表说明文档
<暗黑世界V1.3>数据库表说明文档 (下载地址:http://www.9miao.com/forum.php?mod=viewthread&tid=38821&highl ...