Can we replace HAProxy with NGINX

lchennup nginx-forum at forum.nginx.org
Thu Mar 16 22:37:49 UTC 2017


Hi,

I have the following HAProxy configuration:

global
    log         127.0.0.1 local1
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    --- 
	---

    tune.comp.maxlevel  5
defaults
    mode                    http
    log                     global
    option                  httplog
     ----------
	 --------
	 --------                              
    maxconn                 3000
        # enable compression (haproxy v1.5-dev13 and above required)
    compression algo gzip
    compression type text/html application/javascript text/css
application/x-javascript text/javascript application/json
frontend http-in
    bind *:443 ssl crt /etc/ssl/example.com 

        mode http

        http-request redirect scheme https if { hdr(Host) -i example.com }
!{ ssl_fc }
		
		acl cluster1_dead nbsrv(service_servers) lt 1
		http-request deny if cluster1_dead
		
		acl is_service path_beg -i /Module/service
		
		use_backend service_servers if is_service

        default_backend web_servers
backend web_servers
        balance    roundrobin
        option forwardfor

        cookie SERVERID insert secure httponly maxidle 60m maxlife 180m
indirect
       
        server exampl.com_id example.com:8080 cookie example.com_name check
port 8080 inter 1000 

backend service_servers
        balance    roundrobin
        option forwardfor

        cookie SERVERID insert secure httponly maxidle 60m maxlife 180m
indirect
		reqrep ^([^\ :]*)\ /Module/service/(.*)     \1\ /Module1/\2
       
        server exampl.com_id example.com:8080 cookie example.com_name check
port 8080 inter 1000 
		

listen stats :1936
        mode http
        stats enable
        stats hide-version
        stats realm Haproxy\ Statistics
        stats uri /
        stats auth haproxy:password

Can the above is possible to do with NGINX?.

Thanks,

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,272994,272994#msg-272994



More information about the nginx mailing list