Skip to content

Nginx installation for Alma8

Install nginx package

yum install WBXnginx

Modify configuration

modify default.conf

vi /opt/nginx/conf.d/default.conf
Overwrite default.conf with following code and the 3rd line server_name use the real hostname like "mtny2mvgnx002.webex.com"
server {
    listen       80 default_server;
    server_name ${hostname};  

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;
    if ($bad_method = 1) { return 444; }
    set $flag 0;
    if ($http_user_agent != Grafana){
      set $flag "${flag}1";
    }
    if ($http_user_agent != MCT){
      set $flag "${flag}2";
    }
    if ($http_user_agent !~* PostmanRuntime){
      set $flag "${flag}3";
    }
    if ($http_user_agent != WebexTeams){
      set $flag "${flag}4";
    }
    if ($http_user_agent !~* Squared){
      set $flag "${flag}5";
    }
    if ($http_user_agent !~* curl){
      set $flag "${flag}6";
    }
    if ($http_user_agent !~* Go-http-client){
      set $flag "${flag}7";
    }
    if ($flag = 01234567){
      return 403;
    }
    location = / {
         default_type text/html;
         charset utf-8;
         return 200 "OKOKOK";
    }
    # deny access to files ending with a ~
    location ~ ~$ { access_log off; log_not_found off; deny all; }

    # deny access to “dot” files
    location ~ /\. { access_log off; log_not_found off; deny all; }

    #deny access to files named .ht*
    location ~ /.ht { access_log off; log_not_found off; deny all; }


    location ~* /(images|cache|media|logs|tmp)/.*.(php|pl|py|jsp|asp|sh|cgi)$ {
    return 403;
    error_page 403  /403.html;
    }


    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 501 502 503 504 505  /error.html;
    location = /error.html {
        root   /opt/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
    location /nginx_status {
        stub_status on;
        access_log on;
        allow 127.0.0.1;
        #deny all;
    }

    include /opt/nginx/conf.d/location.conf;
}

modify nginx.conf

vi  /opt/nginx/conf/nginx.conf
modify the last line include /opt/nginx/conf.d/*.conf to include /opt/nginx/conf.d/default.conf

add location.conf file

vi /opt/nginx/conf.d/location.conf
location ^~ /icbotcardbts/ {
  proxy_method  POST;
  proxy_pass http://10.241.93.212/;
}

location ^~ /stap/ {
  client_max_body_size 100M;
  client_body_buffer_size 100M;
  uwsgi_send_timeout 600;
  uwsgi_connect_timeout 600;
  uwsgi_read_timeout 600;
  proxy_read_timeout 600;
  proxy_connect_timeout 600;
  proxy_send_timeout 600;
  proxy_method  POST;
  proxy_pass https://stap.webex.com/;
}

location ^~ /API/v1/dataservice/alert/webhook/AVOPS {
  client_max_body_size 100M;
  client_body_buffer_size 100M;
  uwsgi_send_timeout 600;
  uwsgi_connect_timeout 600;
  uwsgi_read_timeout 600;
  proxy_read_timeout 600;
  proxy_connect_timeout 600;
  proxy_send_timeout 600;
  proxy_method POST;
  proxy_pass https://stap.webex.com/API/v1/dataservice/alert/webhook/AVOPS;
}

location ^~/ta/alertcollector/mav {
  client_max_body_size 100M;
  client_body_buffer_size 100M;
  uwsgi_send_timeout 600;
  uwsgi_connect_timeout 600;
  uwsgi_read_timeout 600;
  proxy_read_timeout 600;
  proxy_connect_timeout 600;
  proxy_send_timeout 600;
  proxy_method  POST;
  proxy_pass http://10.240.213.84:8181/alertcollector/mav;
}

location ^~/sj/alertcollector/mav {
  client_max_body_size 100M;
  client_body_buffer_size 100M;
  uwsgi_send_timeout 600;
  uwsgi_connect_timeout 600;
  uwsgi_read_timeout 600;
  proxy_read_timeout 600;
  proxy_connect_timeout 600;
  proxy_send_timeout 600;
  proxy_method  POST;
  proxy_pass http://10.252.124.150:8181/alertcollector/mav;
}

location ^~/alerthub/alertcollector/mav {
  client_max_body_size 100M;
  client_body_buffer_size 100M;
  uwsgi_send_timeout 600;
  uwsgi_connect_timeout 600;
  uwsgi_read_timeout 600;
  proxy_read_timeout 600;
  proxy_connect_timeout 600;
  proxy_send_timeout 600;
  proxy_method  POST;
  proxy_pass https://alerthub.webex.com/alertcollector/mav;
}

location ^~/sj/mav/test {
  proxy_pass http://10.252.52.79:5000/mav/test;
}

location ^~/cyber/alertwebhook/jsonmav {
  proxy_method  POST;
  proxy_pass http://cyber.webex.com/alertwebhook/jsonmav;
}

location ^~/cyber/alertwebhook/proxyapi {
  proxy_method  POST;
  proxy_pass http://cyber.webex.com/alertwebhook/proxyapi;
}

location ^~/cyber/alertwebhook/mav {
  proxy_method  POST;
  proxy_pass http://cyber.webex.com/alertwebhook/mav;
}

Start nginx

/opt/nginx/sbin/nginx

other Command

/opt/nginx/sbin/nginx -s stop /opt/nginx/sbin/nginx -s reload

Verify via postman

Get request IP:80, return "OKOKOK" image

Nginx server failover

Ssh login primary machine and run service nginx stop, so that all requests will be sent to the slave machine.

Nginx server failback

Apply VIP via SNOW for new server, search "Network-VIP Configuration".

Is this a New or Existing VIP = New
Existing VIP address and DNS name = 
Specify the DNS names for each VIP = alerttrans.webex.com
What service is this VIP for = MAV
MMP Pool ID = 
IPv4 - Public or Private VIP address = Private
Justification for a Public VIP Address = 
GSLB Required = Yes
Specify the primary and GSB site = alerttrans-sjc.webex.com,alerttrans-ta.webex.com
Provide an existing VIP to reference = 66.163.37.201
Market = Commercial
Project = PRO0005079 | SJC Moveout  | INTAKE-245
Priority = 2 - High
Justification = MTV5
COVID-19? = No
Data Center = JFK02
Description = Change the real server ip to JFK02 from SJC02 for MAV PROD nginx server
- VIP for JFK PROD example attachment needs to upload. PROD MAV nginx VIP-Change_JFK02.xls - Someone will contact us, help us to remove the decommissioned server and add new server for GSLB.Or we can ask Somia Nair for help.