Tag: Tomcat |

apache 安装配置

 1. 安装 apr-1.4.6

./configure --prefix=/home/tztrans/apache2x/apr
make
make install
 
2. 安装 apr-util-1.5.1
./configure --prefix=/home/tztrans/apache2x/apr-util --with-apr=/home/tztrans/apache2x/apr
make 
make install
 
3. 安装 pcre-8.32
./configure --prefix=/home/tztrans/apache2x/pcre
make 
make install
 
4. 安装 libxml2-2.9.0
./configure --prefix=/home/tztrans/apache2x/libxml2
这里会报错【/bin/rm: cannot remove `libtoolT’: No such file or directory】
【 解决方案:configure,把 $RM “$cfgfile” 那17035行删除掉,重新再运行 ./configure 就可以了】
make
make install
 
 
5. 安装 httpd-2.4.3
./configure --prefix=/home/tztrans/apache2x/ --with-apr=/home/tztrans/apache2x/apr --with-apr-util=/home/tztrans/apache2x/apr-util --with-pcre=/home/tztrans/apache2x/pcre --with-libxml2=/home/tztrans/apache2x/libxml2
make
make install
 
6. 安装 mod_proxy_html/mod_proxy_html.c
/home/tztrans/apache2x/bin/apxs -c -I/home/tztrans/apache2x/libxml2/include/libxml2/ -i -I. mod_proxy_html.c
 
7. 安装 mod_proxy_html/mod_xml2enc.c
/home/tztrans/apache2x/bin/apxs -c -I/home/tztrans/apache2x/libxml2/include/libxml2/ -i -I. mod_xml2enc.c
 
固定链接 | 评论: 0 | 引用: 0 | 查看次数: 28

apache 虚拟主机配置2

<VirtualHost *:8081>
    ProxyPreserveHost On
    ServerName lt3g.chainbuy.cn
    RewriteEngine On
    RewriteRule  ^/rudd-web(.*) http://132.35.76.52:9081/rudd-web$1 [P,L]

    RewriteRule ^/(.*) http://esales.10010.com/$1 [P,L]
    ProxyPassReverseCookieDomain 10010.com lt3g.chainbuy.cn
    ProxyPassReverseCookiePath / /
  <Location ~ "^(?!\/Js\/(datepicker|time)\/)">
      ProxyHTMLEnable On
       ProxyHTMLExtended On
       ProxyHTMLMeta On
       ProxyHTMLDoctype XHTML Legacy
       ProxyHTMLURLMap http://132.35.76.52:9081 http://lt3g.chainbuy.cn:8081 e
       RequestHeader    unset  Accept-Encoding
   </Location>
  ErrorLog "|/home/tztrans/apache2x/bin/rotatelogs /home/tztrans/apache2x/logs/10010.com-error_%y-%m-%d.log 86400"
  CustomLog "|/home/tztrans/apache2x/bin/rotatelogs /home/tztrans/apache2x/logs/10010-access_%y-%m-%d.log 86400" common
</VirtualHost>

<VirtualHost *:80>
    ProxyPreserveHost On
    ServerName www.g.com
    RewriteEngine on
    RewriteRule ^/m(.*) http://127.0.0.1:8080/m$1 [L,R=301,P,NC]
    RewriteRule (.*) http://127.0.0.1:8080/$1 [L,R=301,P,NC]
    ErrorLog "d:/dummy-host2.javaen.com-error.log"
    CustomLog "d:/dummy-host2.javaen.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ProxyPreserveHost On
    ServerName www.g.com  
    ProxyPass / http://127.0.0.1:8080/a/
    ProxyPassReverse / http://127.0.0.1:8080/a/
    ProxyPassReverseCookieDomain 127.0.0.1:8080/a/ www.g.com
    ProxyPassReverseCookiePath / /
    ErrorLog "d:/dummy-host2.javaen.com-error.log"
    CustomLog "d:/dummy-host2.javaen.com-access.log" common  
</VirtualHost>

<VirtualHost *:80>
    ProxyPreserveHost On
    ServerName www.g.com  
    ProxyPass /manager/ http://127.0.0.1:8080/m/
    ProxyPassReverse /manager/ http://127.0.0.1:8080/m/
    ProxyPassReverseCookieDomain 127.0.0.1:8080/m/ www.g.com
    ProxyPassReverseCookiePath / /manager/
    ErrorLog "d:/dummy-host2.javaen.com-error.log"
    CustomLog "d:/dummy-host2.javaen.com-access.log" common  
</VirtualHost>

<VirtualHost *:80>
    ProxyPreserveHost On
    ServerName lt3g.g.com  
    RewriteEngine on
    RewriteRule  ^/rudd-web(.*) http://132.35.76.52:9081/rudd-web$1 [L,R=301,P,NC]
    RewriteRule ^/(.*) http://esales.10010.com/$1 [L,R=301,P,NC]
    ProxyPassReverseCookieDomain 10010.com lt3g.g.com
    ProxyPassReverseCookiePath / /
    <Location />  
     ProxyHTMLEnable On
     ProxyHTMLMeta On
     ProxyHTMLExtended On
     ProxyHTMLURLMap http://132.35.76.52:9081 http://lt3g.g.com
    </Location>  
    ErrorLog "d:/dummy-host2.javaen.com-error.log"
    CustomLog "d:/dummy-host2.javaen.com-access.log" common  
</VirtualHost>

  <VirtualHost *:8080>
    ProxyPreserveHost On
    ServerName lt3g.chainbuy.net
    RewriteEngine on
    RewriteRule  ^/rudd-web(.*) http://132.35.76.52:9081/rudd-web$1 [L,R=301,P,NC]
    RewriteRule ^/(.*) http://esales.10010.com/$1 [L,R=301,P,NC]
    ProxyPassReverseCookieDomain 10010.com lt3g.chainbuy.net
    ProxyPassReverseCookiePath / /
    <Location />
       ProxyHTMLEnable On
       ProxyHTMLExtended On
       ProxyHTMLURLMap http://132.35.76.52:9081 http://lt3g.chainbuy.net:8080
RequestHeader    unset  Accept-Encoding
</Location>
    ErrorLog "|/home/tzweb/apache2-http-2.4.3/bin/rotatelogs /home/tzweb/apache2-http-2.4.3/logs/lt3g.chainbuy.net-error_%y-%m-%d.log 86400"
    CustomLog "|/home/tzweb/apache2-http-2.4.3/bin/rotatelogs /home/tzweb/apache2-http-2.4.3/logs/lt3g.chainbuy.net-access_%y-%m-%d.log 86400" common
</VirtualHost>

<VirtualHost *:8081>
    ProxyPreserveHost On
    ServerName lt3g.chainbuy.cn
    RewriteEngine On
    RewriteRule  ^/rudd-web(.*) http://132.35.76.52:9081/rudd-web$1 [P,L]

    RewriteRule ^/(.*) http://esales.10010.com/$1 [P,L]
    ProxyPassReverseCookieDomain 10010.com lt3g.chainbuy.cn
    ProxyPassReverseCookiePath / /
  <Location ~ "^(?!\/Js\/(datepicker|time)\/)">
      ProxyHTMLEnable On
       ProxyHTMLExtended On
       ProxyHTMLMeta On
       ProxyHTMLDoctype XHTML Legacy
       ProxyHTMLURLMap http://132.35.76.52:9081 http://lt3g.chainbuy.cn:8081 e
       RequestHeader    unset  Accept-Encoding
   </Location>
  ErrorLog "|/home/tztrans/apache2x/bin/rotatelogs /home/tztrans/apache2x/logs/10010.com-error_%y-%m-%d.log 86400"
  CustomLog "|/home/tztrans/apache2x/bin/rotatelogs /home/tztrans/apache2x/logs/10010-access_%y-%m-%d.log 86400" common
</VirtualHost>


http://xinkang120.blog.163.com/blog/static/1946682232012118111458471/
http://www.blogjava.net/libin2722/articles/344405.html

固定链接 | 评论: 0 | 引用: 0 | 查看次数: 77

apache 反向代理 tomcat会话丢失

关键在于tomcat 中的应用context 路径是 /m, 而外部访问context 路径是 / ,JSESSIONID 的值从浏览器经过反向代理到达tomcat时,由于cookie时内外路径不一致,使tomcat每次重写设置JSESSIONID 的值,导致session丢失现象,在apache VirtualHost中需要通过ProxyPassReverseCookiePath  指令做一个路径映射,详细如下:
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:8080/m/
    ProxyPassReverse / http://127.0.0.1:8080/m/
    ProxyPassReverseCookieDomain locahost www.domain.cn
    ProxyPassReverseCookiePath /m /

固定链接 | 评论: 0 | 引用: 0 | 查看次数: 68

Linux 查看端口占用

netstat -anp |grep 9111

ps -ef | grep java

kill -9 27063

固定链接 | 评论: 0 | 引用: 0 | 查看次数: 21