설정 - 동정 분리

4. 움직임 분리 설정
nginx. conf 설정
 upstream tomcat_server{                     
         server 10.25.39.131:8080;
        server 10.25.39.132:8080;
       }
   server {
        listen      80;
        server_name  www.wxvote.com;

      ##     
           location = / {
            root  WeiXinVote;
            index index.html; 
       }
     location ~* \.(html|css|js|gif|jpg|jpeg|mp4|ttf|eot|svg|woff)$ {
         ##~*               
           root  WeiXinVote;                
       }

        ##  :     ^~ ,        。
        ##^~     uri          ,      url    

        location ^~ /upload/
         {       
        proxy_pass http://tomcat_server/upload/;
         proxy_set_header  Host    $host;
          }

        location /
          {       
          proxy_pass http://tomcat_server/WeiXinVote/;
         proxy_set_header  Host    $host;
          }
    }

키 코드
location ~* \.(html|css|js|gif|jpg|jpeg|mp4|ttf|eot|svg|woff)$ {
     ##~*               
       root  WeiXinVote;                
   }
 #          ,       
   location ~ ^/(js|css|plugins|img|json|font|html|gif|jpg|jpeg|png|bmp|swf)/ {
   #            
    root D:/nginx-1.10.3/jd/;
   expires 30d;
   }

좋은 웹페이지 즐겨찾기