Nginx 配置
张继建 2021/6/1  中间件
# 1.前端资源存放位置
说明:
前端资源现在放在K8Smater机器上,上面会有Nginx;
后端服务和svc用到的yaml文件已项目放在同一个项目目录下;
svc存放后端服务需要对外暴露的yaml文件
view存放前端静态资源,只存放index.html和favicon.ico,其余的静态资源放在对象存储里
yaml存放后端服务需要k8syaml文件
# 2.Nginx配置
#平台管理前端服务(uat)
    server {
        listen       20004;
        server_name  localhost;
        location / {
            #proxy_pass http://ith-admin-view;  
            #proxy_redirect default;
            #写到index.html文件存放的位置
			root /home/workspaces/ith-uat/view/ithuat-admin;
        }
	   location /adminview {
			#proxy_pass http://ith-admin-view;  
			#proxy_redirect default;
			alias /home/workspaces/ith-uat/view/ithuat-admin;
			try_files $uri $uri/ /adminview/index.html;
        }
        #解决跨域
        location ~ ^/api/(.*)$ {  
			# 监听所有/apis前缀,是则转发后台api接口地址
            #rewrite  ^/api/(.*)$ /$1 break;  
			# 后台api接口地址
            proxy_pass   http://117.71.53.195:20049;            
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
#供应链前端服务(uat)
	server {
		listen       20000;
		server_name  localhost;
		location / {
			#proxy_pass http://ith-member-view;  
			#proxy_redirect default;
			root /home/workspaces/ith-uat/view/ithuat-member;
			}
		location /memberview {
			#proxy_pass http://ith-member-view;  
			#proxy_redirect default;
			#前端静态资源路径
			alias /home/workspaces/ith-uat/view/ithuat-member;
			try_files $uri $uri/ /memberview/index.html;
		}
		#解决跨域
		location ~ ^/api/(.*)$ { 
			# 监听所有/apis前缀,是则转发后台api接口地址
			#rewrite  ^/api/(.*)$ /$1 break; 
			# 后台api接口地址			
			proxy_pass   http://117.71.53.195:20049;		
		}
		error_page   500 502 503 504  /50x.html;
		location = /50x.html {
			root   html;
			}
	}
#单点登录前台(uat)	
	server {
		listen       20001;
		server_name  localhost;
		location / {
			#proxy_pass http://ith-sso-view;  
			#proxy_redirect default;
			root /home/workspaces/ith-uat/view/ithuat-sso;
		}
		location /ssoview{
			alias /home/workspaces/ith-uat/view/ithuat-sso;
			try_files $uri $uri/ /ssoview/index.html;
		}
		#解决跨域
		location ~ ^/api/(.*)$ {                                # 自定义nginx接口前缀
			#rewrite  ^/api/(.*)$ /$1 break;            # 监听所有/apis前缀,是则转发后台api接口地址
			proxy_pass   http://117.71.53.195:20049;            # 后台api接口地址
		}
		error_page   500 502 503 504  /50x.html;
		location = /50x.html {
			root   html;
		}
	}
#BPM(uat)	
	server {
		listen       20002;
		server_name  localhost;
		location / {
			#proxy_pass http://ith-sso-view;  
			#proxy_redirect default;
			root /home/workspaces/ith-uat/view/ithuat-bpm;
		}
		location /ithbpm{
			alias /home/workspaces/ith-uat/view/ithuat-bpm;
			try_files $uri $uri/ /ithbpm/index.html;
		}
		#解决跨域
		location ~ ^/api/(.*)$ {                                # 自定义nginx接口前缀
			#rewrite  ^/api/(.*)$ /$1 break;            # 监听所有/apis前缀,是则转发后台api接口地址
			proxy_pass   http://117.71.53.195:20049;            # 后台api接口地址
		}
		error_page   500 502 503 504  /50x.html;
		location = /50x.html {
			root   html;
		}
	}