Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92787
  • 博文数量: 33
  • 博客积分: 1088
  • 博客等级: 少尉
  • 技术积分: 365
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-30 13:59
文章分类

全部博文(33)

文章存档

2011年(18)

2010年(9)

2009年(6)

分类: 系统运维

2010-08-02 17:40:23

目的隐藏源路径后剩下的路径转到需要路径,如:打开gonline.yesky.com显示首页为yesky.comic.gonline.com/comic页

打开apache的proxy_http模块(也打开了proxy模块,依赖关系):
    a2enmod proxy
    a2enmod proxy_http

配置proxy.conf 

<IfModule mod_proxy.c>
        #turning ProxyRequests on and allowing proxying from all may allow
        #spammers to use your proxy to send email.

        ProxyRequests Off

        <Proxy 10.50.21.140:8080>
# AddDefaultCharset off
                Order deny,allow
                #Deny from all
                Allow from all
                #Allow from .example.com
        </Proxy>

        # Enable/disable the handling of HTTP/1.1 "Via:" headers.
        # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
        # Set to one of: Off | On | Full | Block

# ProxyVia On
</IfModule>

配置VirtualHost
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DirectoryIndex index.php index.html index.htm
    DocumentRoot /opt/www_data/yesky.comic.gonline.com/public_html
    ServerName gonline.yesky.com
    <Directory /opt/www_data/yesky.comic.gonline.com/public_html>
        Options Indexes FollowSymLinks Multiviews
        AllowOverride All
    </Directory>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/$
    RewriteRule ^/$ http://yesky.comic.gonline.com/comic/ [P]
    RewriteCond %{REQUEST_URI} !^/$
    RewriteRule ^/comic/(.+)$ http://yesky.comic.gonline.com/comic/$1 [R=301,L]
    RewriteCond %{REQUEST_URI} !^/comic/|^/images/|^/src/|^/comic$|^/index.php/comic/|^/index.php/comic$|crossdomain.xml|/tasks/|/gce/|/award/|/toolbar/|/cartoon/|/book/|/search/
    RewriteRule ^/(.*) http:// [R=301,L]
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DirectoryIndex index.php index.html index.htm
    DocumentRoot /opt/www_data/yesky.comic.gonline.com/public_html
    ServerName yesky.comic.gonline.com
    <Directory /opt/www_data/yesky.comic.gonline.com/public_html>
        Options Indexes FollowSymLinks Multiviews
        AllowOverride All
    </Directory>
    ErrorLog /opt/www_data/nfs_from_10/logs/error_yesky.comic.gonline.com.log
    CustomLog /opt/www_data/nfs_from_10/logs/access_yesky.comic.gonline.com.log combined

    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/comic/|^/images/|^/src/|^/comic$|^/index.php/comic/|^/index.php/comic$|crossdomain.xml|/tasks/|/gce/|/award/|/toolbar/|/cartoon/|/book/|/search/
    RewriteRule ^/(.*) http:// [R=301,L]
</VirtualHost>


阅读(846) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~