summaryrefslogtreecommitdiff
path: root/parcels/roles/services/galaxy-gateway-nginx/templates/nginx.conf-hos.j2
diff options
context:
space:
mode:
Diffstat (limited to 'parcels/roles/services/galaxy-gateway-nginx/templates/nginx.conf-hos.j2')
-rw-r--r--parcels/roles/services/galaxy-gateway-nginx/templates/nginx.conf-hos.j2131
1 files changed, 131 insertions, 0 deletions
diff --git a/parcels/roles/services/galaxy-gateway-nginx/templates/nginx.conf-hos.j2 b/parcels/roles/services/galaxy-gateway-nginx/templates/nginx.conf-hos.j2
new file mode 100644
index 0000000..b4e8d1c
--- /dev/null
+++ b/parcels/roles/services/galaxy-gateway-nginx/templates/nginx.conf-hos.j2
@@ -0,0 +1,131 @@
+worker_processes 4;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+
+ include mime.types;
+ default_type application/octet-stream;
+ sendfile on;
+ keepalive_timeout 65;
+ vhost_traffic_status_zone;
+ vhost_traffic_status_filter_by_host on;
+
+ upstream qgwService {
+{% for dev_info in ansible_play_hosts %}
+ server {{dev_info}}:8183;
+{% endfor %}
+ }
+
+ upstream jobAdmin {
+{% for dev_info in ansible_play_hosts %}
+ server {{dev_info}}:8184;
+{% endfor %}
+ }
+
+ upstream druidQuery {
+ server {{ groups.druid[0] }}:8088;
+ server {{ groups.druid[1] }}:8088;
+ }
+
+ upstream nacos {
+{% for dev_info in groups.nacos %}
+ server {{dev_info}}:8847;
+{% endfor %}
+ }
+
+ server {
+ listen 9999;
+ server_name localhost;
+
+ location / {
+
+ proxy_pass http://qgwService; #请求转发到查询引擎集群
+
+ proxy_http_version 1.1; #指定使用http1.1版本
+
+ proxy_read_timeout 21600; #等待后端服务响应的最大时长
+
+ gzip on; #开启压缩
+
+ gzip_comp_level 6; #压缩级别
+
+ gzip_min_length 1k; #启用gzip压缩的最小文件,小于设置值的文件将不会压缩
+
+ gzip_types application/json; #压缩文件类型
+
+ gzip_vary on; #是否传输gzip压缩标志
+
+ }
+ }
+
+ server {
+ listen 8181;
+ server_name localhost;
+ location / {
+ proxy_pass http://jobAdmin;
+ }
+ }
+
+ server {
+ listen 8089;
+ server_name localhost;
+ location / {
+ proxy_pass http://druidQuery;
+ }
+ }
+
+ server {
+ listen 8848;
+ server_name localhost;
+ location / {
+ proxy_pass http://nacos;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header REMOTE-HOST $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ }
+ }
+
+ server {
+ listen 9913;
+ server_name localhost;
+ location /status {
+ vhost_traffic_status_display;
+ vhost_traffic_status_display_format html;
+ }
+
+ }
+}
+
+stream {
+
+ # preread_buffer_size 64k;
+ # preread_timeout 90s;
+ # proxy_protocol_timeout 300s;
+ # resolver_timeout 10s;
+
+ log_format proxy '$remote_addr [$time_local] '
+ '$protocol $status $bytes_sent $bytes_received '
+ '$session_time "$upstream_addr" '
+ '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
+
+ access_log /usr/local/nginx/logs/access.log proxy ;
+ open_log_file_cache off;
+ include /etc/nginx/conf.d/*.stream;
+
+ upstream hos {
+{% for dev_info in groups.hos %}
+ server {{dev_info}}:8186 max_fails=1 fail_timeout=60s;
+{% endfor %}
+ }
+
+ server {
+ listen 9098;
+ proxy_connect_timeout 20s;
+ proxy_timeout 20s;
+ proxy_pass hos;
+ }
+}
+