方式一
静态资源逐个指定后缀代理至本地,api代理至其它。本地经由8000端口又转了一下,依据不同项目名指向本地不同文件夹。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
| worker_processes 1;
events { worker_connections 1024;
}
http { include mime.types; default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream dfb3 { }
upstream staticservice { server 127.0.0.1:8000; }
server { listen 8080; server_name localhost;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|html|eot|svg|ttf|woff|ico|xlsx)$ { root html/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Accept-Encoding "none"; proxy_ignore_headers "Cache-Control" "Expires"; if ( !-e $request_filename ){ proxy_pass http://staticservice; } }
location / { proxy_pass http://dfb3/; } }
server { listen 8000; server_name 0.0.0.0;
location / { root E:/workSpace/xxx/yyy/aaa/main; index mainFrame.html; } location /goods/ { root E:/workSpace/xxx/yyy/bbb/main; } location /afddd-mmu/ { root E:/workSpace/xxx/yyy/ccc/main; } location ~ /xlljj-ii/ { root E:/workSpace/xxx/yyy/ddd/main; index main.html; } } }
|
方式二
启5000访问,,静态文件代理至本地已启服务器8001,api代理至其它。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
worker_processes 1;
events { worker_connections 1024;
}
http { include mime.types; default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream firstdemo { server 39.106.145.33; server 47.93.6.93; }
server{
listen 5000; server_name localhost5000;
location /{ proxy_pass http://192.168.1.3:8001; }
location /jinqiao{ proxy_pass http://59.110.24.201/jinqiao; }
location /kouqiang{ proxy_pass http://59.110.24.201/kouqiang; }
location /sth { proxy_pass http://firstdemo; } }
}
|
原始conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
worker_processes 1;
events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server { listen 80; server_name localhost;
location / { root html; index index.html index.htm; }
error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }
}
}
|