2012年7月11日 星期三

Tomcat

deploy.bat
-----------------------------------------

call d:\grails-1.0.3.bat
d:

cd "D:\ecweb\staticFiles"
TortoiseProc.exe /command:update /path:"." /notempfile /closeonend:1

cd "D:\brands\club\50_DEV20"
TortoiseProc.exe /command:update /path:"." /notempfile /closeonend:1

call grails clean
call grails -Dgrails.env=production war

c:
cd "C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps"
net stop "Tomcat5"
del ec.war
rmdir ec /S /Q
copy "D:\brands\club\50_DEV20\ec.war" "C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ec.war"
net start "Tomcat5"


-----------------------------------
JMDI
server.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
   
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->

   <Resource name="jdbc/ec" auth="Container"
            type="javax.sql.DataSource" username="ecapuser" password="ecapuser"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://127.0.0.1:1433;database=ecweb;"
            maxActive="20" maxIdle="10" maxWait="-1" />

</Context>

Nginx conf(win)

#user  nobody;

worker_processes  4;
worker_cpu_affinity 0001 0010 0100 1000;
worker_rlimit_nofile 65535;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;
    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_min_length  1024;
    gzip_buffers  4 8k;
    gzip_comp_level  6;
    gzip_types  text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary on; #limit_zone crawler

    #proxy_cache_path  cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;
    #proxy_temp_path   cache/tmp;

    server {
        listen       80;
        #server_name  127.0.0.1;
          #server_name  localhost;
        server_name  172.18.9.7;
       

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://172.18.9.7:8080;
            #proxy_cache my-cache;
            proxy_set_header   Host $host;
            proxy_set_header X-Forwarded-For  $remote_addr;
            #proxy_cache_valid  200 302  60m;
            #proxy_cache_valid  404      1m;
           
             if ($request_uri ~* \.(ico|css|jsgif|jpe?g|png)$) {
                        expires 72h;
                        break;
                }

            proxy_read_timeout 1200;
            proxy_connect_timeout 1200;

        }
        rewrite  ^/$  http://$host/ec  last;
        rewrite  ^/mobile/$/   http://$host/mobile/$1  last;
        rewrite  ^/probe/$/   http://$host/probe/$1  last;
        rewrite  ^/888$   http://$host/ec/888/$1  last;
   
    }
   
   
   
   
   
     server {
        listen       80;      
        server_name  club.brands.com.tw;
       

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://club.brands.com.tw:8080;
            #proxy_cache my-cache;
            proxy_set_header   Host $host;
            proxy_set_header X-Forwarded-For  $remote_addr;
            #proxy_cache_valid  200 302  60m;
            #proxy_cache_valid  404      1m;
           
             if ($request_uri ~* \.(ico|css|jsgif|jpe?g|png)$) {
                        expires 72h;
                        break;
                }

            proxy_read_timeout 1200;
            proxy_connect_timeout 1200;

        }
        rewrite  ^/$  http://club.brands.com.tw/ec  last;
        rewrite  ^/mobile/$/   http://club.brands.com.tw/mobile/$1  last;
        rewrite  ^/probe/$/   http://club.brands.com.tw/probe/$1  last;
        rewrite  ^/888$   http://club.brands.com.tw/ec/888/$1  last;
    }
   
     server {
        listen       80;     
        server_name  mall.brands.com.tw;
       

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            proxy_pass http://mall.brands.com.tw:8080;
            #proxy_cache my-cache;
            proxy_set_header   Host $host;
            proxy_set_header X-Forwarded-For  $remote_addr;
            #proxy_cache_valid  200 302  60m;
            #proxy_cache_valid  404      1m;
           
             if ($request_uri ~* \.(ico|css|jsgif|jpe?g|png)$) {
                        expires 72h;
                        break;
                }

            proxy_read_timeout 1200;
            proxy_connect_timeout 1200;

        }
        rewrite  ^/$  http://mall.brands.com.tw/ec  last;
        rewrite  ^/mobile/$/   http://mall.brands.com.tw/mobile/$1  last;
        rewrite  ^/probe/$/   http://mall.brands.com.tw/probe/$1  last;
        rewrite  ^/888$   http://mall.brands.com.tw/ec/888/$1  last;
    }
   

   
   
}