我们致力于一个Apache知识的分享网站

Home » Apache初级应用 » Apache、resin、rewrite泛域名、多域名设置

Apache、resin、rewrite泛域名、多域名设置


2009-02-16 10:44:36  |   才被看了2,915次  |   要评论?
分类: Apache初级应用  |   发布:   |   来源:Codyy技术团队

Tags: ,,

  1. <VirtualHostip:80>
  2. rewriteengine on
  3. rewritecond %{HTTP_HOST} [^.]+\.域名\.com$
  4. rewriterule ^(.+) %{HTTP_HOST}$1 [C]
  5. rewriterule ([^.]+)\.域名\.com(.*) /$1$2
  6. 其他配置文件
  7. </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.comrootdirectory=.>
<hostaliasregexp>^([^/]*).home.243.com</hostaliasregexp>
<redeploymode>manual</redeploymode>
<webapp id=/documentdirectory=/usr/local/pengpeng/xhome//>
</host>
<host id=x.243.comrootdirectory=.>
<hostaliasregexp>^([^/]*).x.243.com</hostaliasregexp>
<redeploymode>manual</redeploymode>
<webapp id=/documentdirectory=/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:

<hostid=”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-appid=”/”document-directory=”/usr/local/pengpeng/channel/”/>
</host>

让apache支持自定义404页面错误 在64位机器上关于Apache 2.2.3版的编译问题

Leave a Reply