limit_req_zone $binary_remote_addr zone=mylimit:20m rate=5r/s; server { listen 80; server_name _; root /usr/share/nginx/html; #将DNS指向kubernetes集群内的DNS resolver kube-dns.kube-system.svc.cluster.local valid=30s; set $oss_endpoint_service zhios-oss.zhios.svc.cluster.local:5000; set $mall_service zhios-mall.zhios.svc.cluster.local:5002; set $domain_server zhios-request-domain.zhios.svc.cluster.local:4040; set $agent_endpoint_service zhios-app-comm.zhios.svc.cluster.local:5003; set $o2ob_endpoint_service zhios-app-o2o.zhios.svc.cluster.local:5004; set $adset_callback_endpoint_service app-comm-adset-callback.zhios.svc.cluster.local:5505; set $b2c_customer_service zyos-b2c-customer.zhios.svc.cluster.local:5009; set $chat_gpt_service chat-gpt.zhios.svc.cluster.local:5200; set $live_broadcast_video_service zyos-live-broadcast-video.zhios.svc.cluster.local:5010; set $o2oc_endpoint_service zhios-app-o2o-customer.zhios.svc.cluster.local:5005; set $endpoint_service zhios-app.zhios.svc.cluster.local:5000; set $community_team_service community-team.zhios.svc.cluster.local:6001; set $super_cloud_issuance_service super-cloud-issuance.zhios.svc.cluster.local:3001; location /api/v1/chatGpt { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$chat_gpt_service; proxy_http_version 1.1; proxy_set_header Origin ""; proxy_set_header Host $host; proxy_set_header X-Real-Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; break; } location /api/v1/communityTeam { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$community_team_service; proxy_http_version 1.1; proxy_set_header Origin ""; proxy_set_header Host $host; proxy_set_header X-Real-Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; break; } location /api/v1/superCloudIssuance { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$super_cloud_issuance_service; proxy_http_version 1.1; proxy_set_header Origin ""; proxy_set_header Host $host; proxy_set_header X-Real-Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; break; } location = / { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$endpoint_service; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header Platform "wap"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /getDomain { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$domain_server; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /static { limit_req zone=mylimit burst=5 nodelay; root /usr/share/nginx/html; index index.html index.htm; } location /api/v1/mall { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$mall_service; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /api/v1/comm/adset { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$adset_callback_endpoint_service; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /api/v2/comm { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$agent_endpoint_service; proxy_set_header Connection ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /api/v1/comm { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$agent_endpoint_service; proxy_set_header Connection ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } # o2o c端 location /api/v1/o2oc { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$o2oc_endpoint_service; proxy_set_header Connection ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } # o2o商家端 location /api/v1/o2o { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$o2ob_endpoint_service; proxy_set_header Connection ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } # 多用户商城c端 location /api/v1/b2cc { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$b2c_customer_service; proxy_set_header Connection ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /api/v1/live_room { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$endpoint_service; #istio下http协议必须大于等于1.1 proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /api/v1/live { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$live_broadcast_video_service; proxy_set_header Connection ""; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } location /api/qiniu { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$oss_endpoint_service; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } #proxy server location /api { limit_req zone=mylimit burst=5 nodelay; proxy_pass http://$endpoint_service; #istio下http协议必须大于等于1.1 proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; break; } }