假设我们把服务器架设在:/home/www文件夹下面

我们有应用A和B,对应的文件目录为
A:/home/www/testA
B:/home/www/testB

设置proxy_module让网站支持泛域名,好像这个是必须设置的,没试过去掉的情况

 <IfModule proxy_module>
UseCanonicalName Off
ProxyVia On
ProxyRequests Off
ProxyPreserveHost On
</IfModule>

两个应用的泛域名支持:(这个可以写在httpd.conf, 也可以在httpd.conf中开启Include conf/extra/httpd-vhosts.conf之后写在httpd-vhosts.conf中)

testA

 <Directory "/home/www/testA">
Options Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "/home/www/testA"
ServerName testA.test.com
</VirtualHost>

testB

 <Directory "/home/www/testB">
Options Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "/home/www/testB"
ServerName testB.test.com
</VirtualHost>

如果一个文件夹下面有多个应用比如:

/home/www/someapp
/home/www/someapp/app1
/home/www/someapp/app2
/home/www/someapp/app3

我们可以这样设置:

 <VirtualHost *:80>
DocumentRoot "/home/www/someapp/"
ServerName *.test.com
ServerAlias *.test.com
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/home/www/test.map
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1
AccessFileName .htaccess_test
</VirtualHost>

这里我们使用了test.map来进行域名的设置

 test.map文件
app1.test.com /home/www/someapp/app1
app2.test.com /home/www/someapp/app2
app3.test.com /home/www/someapp/app3

这样当访问app1.test.com的时候就会自动指定到/home/www/someapp/app1文件夹下面

apache泛域名的配置的更多相关文章

  1. apache 泛域名配置

    需求:  在apache上配置两个项目,分别是项目a和项目b,a.baiye5.com访问项目a,其余的除了a前缀名之外的例如b2b.baiye5.com .*.baiye5.com等都访问项目b. ...

  2. windows下 apache 二级域名相关配置

    小编今天给大家总结下 windows 下 apache的二级域名的相关配置 利用.htaccess将域名绑定到子目录 下面就利用本地127.0.0.1进行测试 我们这里以 www.jobs.com 为 ...

  3. windows下 apache 二级域名相关配置 【转】

    转至: http://www.th7.cn/Program/php/201306/141305.shtml 今天给大家总结下 windows 下 apache的二级域名的相关配置 下面就利用本地127 ...

  4. mac下配置Apache虚拟域名方案,以及遇到的坑(转)

      1. 配置Apache虚拟域名 1.执行    sudo vi /etc/apache2/httpd.conf 开始配置httpd.conf 的文件; //配置listen 80端口(默认配置), ...

  5. mac下配置Apache虚拟域名方案,以及遇到的坑

      1. 配置Apache虚拟域名 1.执行    sudo vi /etc/apache2/httpd.conf 开始配置httpd.conf 的文件; //配置listen 80端口(默认配置), ...

  6. Nginx Rewrite 实现匹配泛域名规则

    Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru ...

  7. 申请 Let’s Encrypt 泛域名证书 及 Nginx/Apache 证书配置

    什么是 Let’s Encrypt? 部署 HTTPS 网站的时候需要证书,证书由 CA (Certificate Authority )机构签发,大部分传统 CA 机构签发证书是需要收费的,这不利于 ...

  8. 【转】Apache虚拟主机的配置和泛解析域名的绑定

    基于IP地址的虚拟主机配置 Listen 80 DocumentRoot /www/example1 ServerName www.example1.com DocumentRoot /www/exa ...

  9. Apache二级域名配置方法

    下面这个Apache二级域名配置方法是今天在其它BBS看到的,以前我配置是都是配置每个为一个虚拟目录今天正在想如何写没想到找到了. Apache二级域名实现方法介绍 首先,你的拥有一个有泛域名解析的顶 ...

随机推荐

  1. Youth(青春)

    Youth is not a time of life; it is a state of mind; it is not a matter of rosy cheeks, red lips and ...

  2. C. Mobile phones

    Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows ...

  3. as3.0 [Embed]标签嵌入外部资源

    1.[Embed]嵌入资源 ActionScript代码的顺序非常重要.你必须在声明变量前添加[Embed]元数据标签,而且这个变量的类型会是Class; package { import flash ...

  4. Oracle基础 TO_CHAR函数参考(转)

    Postgres 格式化函数提供一套有效的工具用于把各种数据类型(日期/时间,int,float,numeric)转换成格式化的字符串以及反过来从格式化的字符串转换成原始的数据类型. 注意:所有格式化 ...

  5. Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    执行远程shell,启动远程机器的tomat时遇到次错误.后来发现原来是远程机器的.profile被人改掉了! 在.profile里加入 export JAVA_HOME=/home/evans/jd ...

  6. 关于bochs用X11启动的说明

    关于网络上有很多关于 bochs启动时 连接到X Windows 报错: cannot connect to X display . 昨天搞了半天+晚上 + 今天早上 + 直到现在 才搞懂. 主要的原 ...

  7. 推荐5款超实用的.NET性能分析工具 转

    http://www.csdn.net/article/2012-11-23/2812174-5-Good-and-useful-.NET-Profilers

  8. Part 10 AngularJS sort rows by table header

    Here is what we want to do 1. The data should be sorted when the table column header is clicked 2. T ...

  9. jQuery AJAX Call for posting data to ASP.Net page ( not Get but POST)

    the following jQuery AJAX call to an ASP.Net page. $.ajax({ async: true, type: "POST", url ...

  10. dropdownlist分页

    <div class="new-paging" id=""> <div class="new-tbl-type"> ...