请选择 进入手机版 | 继续访问电脑版
设为首页收藏本站

php163

php163 首页 技术专栏 apache_nginx 查看内容

apache、resin、rewrit泛域名、多域名设置

2011-11-27 19:11| 发布者: php163| 查看: 1953| 评论: 0

摘要: <VirtualHost ip:80> rewriteengine on rewritecond %{HTTP_HOST} [^.]+\.域名\.com$ rewriterule ^(.+) %{HTTP_HOST

<VirtualHost ip:80>      
         rewriteengine on       
         rewritecond %{HTTP_HOST} [^.]+\.域名\.com$       
         rewriterule ^(.+) %{HTTP_HOST}$1 [C]       
         rewriterule ([^.]+)\.域名\.com(.*) /$1$2       
         其他配置文件       
</VirtualHost>


Apache:

<VirtualHost *:80>
     DocumentRoot /usr/local/pengpeng/xspace/
     ServerName x.243.com
     ServerAlias  *.x.243.com
</VirtualHost>


<VirtualHost *:80>
     DocumentRoot /usr/local/pengpeng/xhome/
     ServerName home.243.com
     ServerAlias  *.home.243.com
</VirtualHost>

Resin:

    <host id="home.243.com" root-directory=".">
       <host-alias-regexp>^([^/]*).home.243.com</host-alias-regexp>
       <redeploy-mode>manual</redeploy-mode>
       <web-app id="/" document-directory="/usr/local/pengpeng/xhome/"/>
    </host>
    <host id="x.243.com" root-directory=".">
       <host-alias-regexp>^([^/]*).x.243.com</host-alias-regexp>
       <redeploy-mode>manual</redeploy-mode>
       <web-app id="/" document-directory="/usr/local/pengpeng/xspace/"/>
    </host>


多域名:

apache:
 

<VirtualHost *:80>
     DocumentRoot /usr/local/pengpeng/channel/
     ServerName blog.pengpeng.com
   
     RewriteEngine On

         # 来自"Host:"头的ServerName ,可能大小写混杂
         RewriteMap lowercase int:tolower

         # 检查hostname正确与否,之后才能使RewriteRule起作用
     RewriteCond ${lowercase:%{HTTP_HOST}} ^blog.pengpeng.com(.*)$
     RewriteCond %{REQUEST_URI} !^/(.+\.do)$

     RewriteRule     ^/index.jsp$    /blog/index.jsp      [PT]
   
</VirtualHost *:80>

<VirtualHost *:80>
     DocumentRoot /usr/local/pengpeng/channel/
     ServerName show.pengpeng.com
   
     RewriteEngine On

         # 来自"Host:"头的ServerName ,可能大小写混杂
         RewriteMap lowercase int:tolower

         # 检查hostname正确与否,之后才能使RewriteRule起作用
     RewriteCond ${lowercase:%{HTTP_HOST}} ^show.pengpeng.com(.*)$
     RewriteCond %{REQUEST_URI} !^/(.+\.do)$

     RewriteRule     ^/index.jsp$    /show/index.jsp      [PT]
   
</VirtualHost *:80>

<VirtualHost *:80>
     DocumentRoot /usr/local/pengpeng/channel/
     ServerName photo.pengpeng.com
   
     RewriteEngine On

         # 来自"Host:"头的ServerName ,可能大小写混杂
         RewriteMap lowercase int:tolower

         # 检查hostname正确与否,之后才能使RewriteRule起作用
     RewriteCond ${lowercase:%{HTTP_HOST}} ^photo.pengpeng.com(.*)$
     RewriteCond %{REQUEST_URI} !^/(.+\.do)$

     RewriteRule     ^/index.jsp$    /photo/index.jsp      [PT]
   
</VirtualHost *:80>

Resin:

<host id="channel.pengpeng.com" root-directory=".">
      <host-alias>blog.pengpeng.com</host-alias>
      <host-alias>show.pengpeng.com</host-alias>
      <host-alias>photo.pengpeng.com</host-alias>
      <web-app id="/" document-directory="/usr/local/pengpeng/channel/"/>
    </host>

1

鲜花

握手

雷人

路过

鸡蛋

刚表态过的朋友 (1 人)


收藏 分享

最新评论

QQ:24940422 2698114111 电话:0532-89993080|Archiver|手机版|php163开源技术分享社区   

GMT+8, 2017-12-19 00:43 , Processed in 0.030141 second(s), 14 queries .

Powered by Discuz!

PHP开源技术分享门户

回顶部