This article provides some examples for using a proxy server to acces the Greenplum Command Center(GPCC) webUI.
Use nginx configuration similar to below example. The IP addresses and ports specified below will need to be changed to appropriate values for your environment.
The main additions/changes to the default configuration file are the "location / " and "location /gpcc_v2/websocket" sections.
The following configuration is for HTTP, if HTTPS is needed, then the appropriate SSL settings will need to be added.
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 5000 default_server; # nginx will listen on port 5000. CHANGE TO APPROPRIATE VALUE
listen [::]:5000 default_server; # nginx will listen on port 5000. CHANGE TO APPROPRIATE VALUE
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#location / {
#}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location / {
proxy_pass http://10.159.240.156:28006; # IP and PORT for the GPCC webserver. CHANGE TO APPROPRIATE VALUE
proxy_set_header Host "10.159.240.156:5000"; # IP and PORT that nginx is listening on. CHANGE TO APPROPRIATE VALUE
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#webproxy support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "connection_upgrade";
}
location /gpcc_v2/websocket {
proxy_pass http://10.159.240.156:28006/gpcc_v2/websocket; # IP and PORT for the GPCC webserver. CHANGE TO APPROPRIATE VALUE
proxy_set_header Host "10.159.240.156:5000"; # IP and PORT that nginx is listening on. CHANGE TO APPROPRIATE VALUE
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
#webproxy support
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
}
}
}
The following is an example haproxy configuration. The IPs and PORTs used in the configuration need to be changed to appropriate values for your environment.
The main change to the default configuration is the "listen gpcc" section.
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# https://www.haproxy.org/download/1.8/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
# local2.* /var/log/haproxy.log
#
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
# utilize system-wide crypto-policies
ssl-default-bind-ciphers PROFILE=SYSTEM
ssl-default-server-ciphers PROFILE=SYSTEM
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
mode tcp
log global
option tcplog
option dontlognull
# option http-server-close
# option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
listen gpcc
bind 10.159.240.156:5000 # IP and PORT that haproxy listens on. CHANGE TO APPROPRIATE VALUE
mode tcp
option tcplog
no option clitcpka
no option srvtcpka
server cdw 10.159.240.156:28006 # SERVERNAME IP:PORT of the GPCC webserver. CHANGE TO APPROPRIATE VALUE