`
thrillerzw
  • 浏览: 139171 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

apache

阅读更多

一、反向代理转发 HTTP 请求到 Tomcat、jboss等配置
修改httpd.conf ,去掉下面2行注释

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

 

末尾加上,如下

ProxyPass /news http://www.iteye.com/news
ProxyPassReverse /news http://www.iteye.com/news

重启

 

二、apache 端口:
      Listen 80

 

三、RewriteRule

 

1)伪静态化的作用,一是达到和真静态化一样的seo效果,二是屏蔽网站的技术实现,让url看起来更优美。

RewriteCond就像我们程序中的if语句一样,表示如果符合某个或某几个条件则执行RewriteCond下面紧邻的RewriteRule语句。RewriteCond语句之间默认的是AND,如果想要OR,则要明确的写出来[OR]。

 

2)几个常用的正则表达式:
(.*) 用于匹配某一区域内所有内容。如 abc/def/ghi 可用 (.*)/(.*)/(.*) 匹配。
([a-zA-Z_]+) 匹配英文单词,允许用-和_连接。
([0-9]+) 匹配多位数字,通常用于匹配ID。
([0-9]) 只匹配一位的数字。
^ 表示正则的开始
$ 表示正则的结束 

 

3)几个常用参数:
RewriteCond下:
[NC] 不分字母大小写
[OR] 用于连接下一条规则
RewriteRule下:
[R] 强制重定向,[R=code] code默认为302
[F] 禁用URL,返回HTTP 403 错误
[L] 这是最后一条规则,之后内容无用

 

4)案例

city_map.txt的内容: 
hangzhou 12 
beijing 13 
1、hangzhou.google.com/tianqi/20090401 跳转到 www.google.com/service/detail.html?id=tianqi&date=20090401

RewriteMap city-map txt:/etc/httpd/conf.d/map/city_map.txt 
RewriteCond %{HTTP_HOST}    ^(.+)\.google\.com$    
RewriteRule ^/([\w]+)/([\d]+)$ /service/detail\.html\?id=$1&date=$2&c=${city-map:%1|%1} [PT,L]

 
解释:
%{HTTP_HOST}:取请求的域名
^(.+)\.google\.com$:^,开头;$结尾。.(逗号),除终止符外的任意字符。+,重复一个或一个以上的字符。\,转义字符。
^/([\w]+)/([\d]+)$:[],集合字符。\w,数字或字母。\d,数字。
$1:表示的是符合RewriteRule 中[\w]+正则式的字符串,也就是tianqi。
$2:表示的是符合RewriteRule 中[\d]+ 正则式的字符串,也就是20090401。
%1:表示的是符合RewriteCond 中.+正则式的字符串,也就是hangzhou。
${city-map:%1|%1}:表示取city-map中%1也就是hangzhou对应的值,如果没有则为%1也就是hangzhou。

 

Apache模块 mod_rewrite 中文文档:  http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_rewrite.html

 

 5、windows设置apache开机不自动启动
开始--运行--msconfig--启动--去掉apache http searver的勾。msconfig--服务--去掉apache2的勾。
计算机管理--服务--apache2  设置为手工启动。

分享到:
评论

相关推荐

    org.apache.http jar包

    org.apache.http jar包 import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org....

    apache-hive-2.1.1-bin.tar

    apache-hive-2.1.1-bin.tar apache-hive-2.1.1-bin.tar apache-hive-2.1.1-bin.tarapache-hive-2.1.1-bin.tar apache-hive-2.1.1-bin.tar apache-hive-2.1.1-bin.tarapache-hive-2.1.1-bin.tar apache-hive-2.1.1-...

    apache-maven-3.8.6.zip

    apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-maven-3.8.6-bin.zip apache-...

    开发工具 apache-tomcat-8.0.41-windows-x86

    开发工具 apache-tomcat-8.0.41-windows-x86开发工具 apache-tomcat-8.0.41-windows-x86开发工具 apache-tomcat-8.0.41-windows-x86开发工具 apache-tomcat-8.0.41-windows-x86开发工具 apache-tomcat-8.0.41-...

    apache-tomcat-10.0.8.zip

    Apache Tomcat 软件是Jakarta Servlet、 Jakarta Server Pages、 Jakarta Expression Language、 Jakarta WebSocket、 Jakarta Annotations和 Jakarta Authentication 规范的开源实现 。 压缩包内容: apache-...

    org.apache.poi jar包

    org.apache.poi JAR包,解决个人的 import org.apache.commons.beanutils.PropertyUtilsBean; import org.apache.commons.lang.StringUtils; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi...

    org.apache.http源代码和jar包

    import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpResponse; import org....

    org.apache.http.legacy.jar

    android 6.0(api 23) SDK上进行更改之后,不再提供org.apache.http.*(只保留几个类) Android studio解决办法: 下载 org.apache.http.legacy.jar这个jar包。放置到程序app-->libs目录下,同步完成,就可以正常访问。...

    org.apache.http 相关的jar包

    import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpResponse; import...

    Apache httpd-2.2.34-win64.zip

    Apache

    the programmer's guide to apache thrift

    Apache Thrift is an open source cross language serialization and RPC framework. With support for over 15 programming languages, Apache Thrift can play an important role in a range of distributed ...

    apache漏洞汇总apache漏洞汇总

    Apache-flink 未授权访问任意jar包上传反弹shell CVE-2019-0193 Apache-Solr via Velocity template RCE CVE-2019-17564 Apache-Dubbo反序列化漏洞 CVE-2020-13925 Apache Kylin 远程命令执行漏洞 CVE-2020-13957 ...

    org.apache.http.httpentity jar包-系列jar包

    import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.conn.scheme.Scheme; ...

    Apache2.4支持mp4-flv的插件.zip

    这个是亲测可用apache2.4版的支持流媒体服务插件。 把 mod_flvx-0.4-Apache-2.4.x-x86.zip mod_h264_streaming-2.2.7-2.4.x-x86.zip 二个文件拷至 Apache2.4\modules 进http.config加 #Apache配置支持流媒体服务...

    可用org.apache.commons.httpclient-3.1.0.jar.zip

    import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods....

    org.apache.poi JAR包

    org.apache.poi JAR包,解决个人的 import org.apache.commons.beanutils.PropertyUtilsBean; import org.apache.commons.lang.StringUtils; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi...

    import org.apache.http

    import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpResponse; import...

    org.apache.http包

    import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; ...

    org.apache.commons.lang jar包下载(commons-lang3-3.1.jar)

    commons-lang3.3.1.jar、Apache Commons包中的一个,包含了一些数据类型工具类,是java.lang.*的扩展。必须使用的jar包。为JRE5.0+的更好的版本所提供 Jar文件包含的类: META-INF/MANIFEST.MFMETA-INF/LICENSE....

    下载慢?给你apache maven 3.x.x所有Linux, Windows版本下载的百度网盘链接

    apache maven 3.x.x所有Linux, Windows版本下载的百度网盘链接。 apache-maven-3.0.4-bin.tar.gz apache-maven-3.0.4-bin.zip apache-maven-3.0.5-bin.tar.gz apache-maven-3.0.5-bin.zip apache-maven-3.1.0-bin....

Global site tag (gtag.js) - Google Analytics