logo

Settings

HAProxy-WI config


Edit $HOME_HAPROXY-WI/app/haproxy-wi.cfg with your env. Default config:
[main]
#Path to files destination
fullpath = /var/www/haproxy-wi
log_path = ${fullpath}/log/

[configs]
#Dir where configs will be save
haproxy_save_configs_dir = ${main:fullpath}/configs/hap_config/
kp_save_configs_dir = ${main:fullpath}/configs/kp_config/
nginx_save_configs_dir = ${main:fullpath}/configs/nginx_config/

[mysql]
#Enable MySQL DB. Default will be used Sqlite DB. Default disable
enable = 0
mysql_user = haproxy-wi
mysql_password = haproxywi
mysql_db = haproxywi
mysql_host = 127.0.0.1
mysql_port = 3306

		

HAProxy config


If you use installed HAProxy without HAProxy-WI then for Runtime API, Metrics and Alerting enable state file and stat socket on the HAProxy servers and needs install socat to the all haproxy servers, and configre the HAProxy:
global
    stats socket *:1999 level admin 
    stats socket /var/run/haproxy.sock mode 600 level admin
    server-state-file /etc/haproxy/haproxy.state

defaults
    load-server-state-from-file global

listen stats 
    bind *:8085
    stats enable
    stats uri /stats
    stats realm HAProxy-04\ Statistics
    stats auth admin:password
    stats admin if TRUE 
		

Nginx config


If you use installed Nginx without HAProxy-WI then for view stats you should add the next configuration to all your Nginx servers:
server {
    listen       8086 ;
    server_name  localhost;

    location /stats {
        stub_status;
        auth_basic           "Resticted Area";
        auth_basic_user_file /etc/nginx/status_page_passwdfile;
    }
}

		
And generate login/password with htpasswd into /etc/nginx/status_page_passwdfile

DB settings


Default the HAProxy-WI uses the Sqlite, if you want to use the MySQL enable it in config:

  • [mysql]
  • #Enable MySQL DB. Default will be used Sqlite DB. Default disable
  • enable = 1
  • mysql_user = haproxywi
  • mysql_password = haproxy-wi
  • mysql_db = haproxywi
  • mysql_host = 127.0.0.1


And create a database:

  • MariaDB [(none)]> create user 'haproxy-wi'@'%';
  • MariaDB [(none)]> create database haproxywi;
  • MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'%' IDENTIFIED BY 'haproxy-wi';
  • MariaDB [(none)]> grant all on haproxywi.* to 'haproxy-wi'@'localhost' IDENTIFIED BY 'haproxy-wi';

Apache settings


If you want to use your own Domain name you should edit haproxy-wi.conf for Apache:
$ sudo vi /etc/httpd/conf.d/haproxy-wi.conf
		
Edit the next string, replace "haprox-wi.example.com" on your own:
<VirtualHost my_domain.local:443>
    ...
    ServerName my_domain.local
    ...
</VirtualHost>
		
And if you want to have redirect from the port 80 to the port 443, you should add next:
<VirtualHost my_domain.local:80>
        ServerName my_domain.local
        Redirect permanent / https://my_domain.local

</VirtualHost>
		
In order to change the certificates you should edit:
<VirtualHost my_domain.local:443>
    ...
    SSLEngine on
    SSLCertificateFile /var/www/haproxy-wi/app/certs/haproxy-wi.crt
    SSLCertificateKeyFile /var/www/haproxy-wi/app/certs/haproxy-wi.key
    ...
</VirtualHost>