7 changed files with 62 additions and 29 deletions
			
			
		@ -1,3 +1,4 @@ | 
				
			|||||
**/*.jar | 
					service/*.jar | 
				
			||||
service/opt/ | 
					service/data/ | 
				
			||||
web/html/ | 
					web/html/ | 
				
			||||
 | 
					images | 
				
			||||
@ -1,21 +1,45 @@ | 
				
			|||||
 | 
					map $http_upgrade $connection_upgrade { | 
				
			||||
 | 
					    default upgrade; | 
				
			||||
 | 
					    '' close; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					upstream back_end { | 
				
			||||
 | 
					    server military-system:8049; # appserver_ip:ws_port | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
server { | 
					server { | 
				
			||||
    listen       8089; | 
					    listen       3001; | 
				
			||||
    listen  [::]:8089; | 
					    listen  [::]:3001; | 
				
			||||
    server_name  localhost; | 
					    server_name  localhost; | 
				
			||||
 | 
					
 | 
				
			||||
    # 后台服务配置,配置了这个location便可以通过访问		 | 
					    # 后台服务配置,配置了这个location便可以通过访问		 | 
				
			||||
	location ^~ /military { | 
					    location ^~ /military { | 
				
			||||
		proxy_pass              http://military-system:8080/military/; | 
					        proxy_pass              http://back_end/military/; | 
				
			||||
		proxy_set_header        Host $host:8089; | 
					        proxy_set_header        Host $host:3001; | 
				
			||||
		proxy_set_header        X-Real-IP $remote_addr; | 
					        proxy_set_header        X-Real-IP $remote_addr; | 
				
			||||
		proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for; | 
					        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for; | 
				
			||||
	} | 
					        location ^~ /military/websocket { | 
				
			||||
	#解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 | 
					            proxy_pass          http://back_end/military/websocket/; | 
				
			||||
	location / { | 
					            proxy_read_timeout  300s; | 
				
			||||
		root   /usr/share/nginx/html; | 
					            proxy_send_timeout  300s; | 
				
			||||
		index  index.html index.htm; | 
					             | 
				
			||||
		if (!-e $request_filename) { | 
					            proxy_set_header        Host $host:3001; | 
				
			||||
			rewrite ^(.*)$ /index.html?s=$1 last; | 
					            proxy_set_header        X-Real-IP $remote_addr; | 
				
			||||
			break; | 
					            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for; | 
				
			||||
		} | 
					             | 
				
			||||
	} | 
					            proxy_http_version  1.1; | 
				
			||||
 | 
					            proxy_set_header    Upgrade $http_upgrade; | 
				
			||||
 | 
					            proxy_set_header    Connection $connection_upgrade; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 | 
				
			||||
 | 
					    location / { | 
				
			||||
 | 
					        root   /usr/share/nginx/html; | 
				
			||||
 | 
					        index  index.html index.htm; | 
				
			||||
 | 
					        if (!-e $request_filename) { | 
				
			||||
 | 
					            rewrite ^(.*)$ /index.html?s=$1 last; | 
				
			||||
 | 
					            break; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
} | 
					} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue