apache 域名转发功能
2016-06-02 10:47
393 查看
1、端口转发功能
#开启
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
#转发之后地址的域名不转向到IP和端口
#RewriteCond %{REQUEST_METHOD} !^POST$
RewriteCond %{HTTP_HOST} ^xx.com.cn
RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:9100/$1 [NC,NE,R=301,P]
#转发之后地址会跳转到IP和端口
RewriteCond %{HTTP_HOST} ^c.xx.com.cn
RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [NC,NE]
RewriteRule ^/a/b.html http://xxx.xxx.xxx.xxx:8002/a/b.html [NC,P]
#例如
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteCond %{HTTP_HOST} ^m.abc.com.cn
RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [NC,NE]
<VirtualHost *:8001>
DocumentRoot "/var/www/html/mobile"
<Directory "/var/www/html/mobile">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
#开启
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
#转发之后地址的域名不转向到IP和端口
#RewriteCond %{REQUEST_METHOD} !^POST$
RewriteCond %{HTTP_HOST} ^xx.com.cn
RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:9100/$1 [NC,NE,R=301,P]
#转发之后地址会跳转到IP和端口
RewriteCond %{HTTP_HOST} ^c.xx.com.cn
RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [NC,NE]
RewriteRule ^/a/b.html http://xxx.xxx.xxx.xxx:8002/a/b.html [NC,P]
#例如
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
RewriteCond %{HTTP_HOST} ^m.abc.com.cn
RewriteRule ^/(.*) http://xxx.xxx.xxx.xxx:8001/$1 [NC,NE]
<VirtualHost *:8001>
DocumentRoot "/var/www/html/mobile"
<Directory "/var/www/html/mobile">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
相关文章推荐
- Apache常用配置项
- ClassNotFoundException:org.apache.commons.logging.LogFactory
- centos64-python27-mod_wsgi-apache2.4
- Mac OS下Web服务器配置
- apache支持中文域名绑定,apache支持中文域名绑定,教你怎样让apache支持中文域名绑定
- apache优化配置
- 远程服务器:PHP5.5+apache2.4+SQL SERVER2008开发环境配置
- Apache重启问题
- apache-ab并发负载压力测试
- Apache Flume 分布式日志收集系统学习
- 用Apache Hadoop和Apache Solr处理和索引医学图像
- Mac OS X 配置 Apache+Mysql+PHP 详细教程
- apache配置虚拟主机及虚拟目录
- ubuntu apache using 127.0.1.1. Set the 'ServerName'
- [置顶] 日志审计-apache攻击日志分析
- 用Apache Spark进行大数据处理——第二部分:Spark SQL
- 我的解决org.apache.commons.lang.xwork.StringUtils异常的方法
- Apache Thrift
- apache.commons.lang.StringUtils 使用心得
- python+Django+apache的配置方法详解