0

new to linux world.

I have setup two apache webserver , one haproxy and one testpc. I am able to curl web server with index.html contents on port 80. but when i try to curl haproxy on any port or port 80 i am getting curl:

(7) Failed connect to 35.229.60.183:80; Connection refused

firewall is turned off on all the servers, restarted the haproxy.

haproxy config file :

defaults
    mode                    http
    log                     global
    option                  httplog
    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           100s
    maxconn                 3000

frontend myserver
bind *:80
default_backend mybackendserver

mybackendserver
 balance roundrobin
 mode http
 server webserver       35.185.18.206:80        check
 server webserver1      35.231.241.247:80       check

when I try to curl them in my test machine i am getting curl:

(7) Failed connect to 35.229.60.183:80; Connection refused

35.229.60.183 is the ip of my haproxy server.

Madhur Bhaiya
  • 28,155
  • 10
  • 49
  • 57
stalin
  • 369
  • 2
  • 5

1 Answers1

0

If I recall correctly, you should enable the port :80 or whatever you use, directly from the Google Cloud dashboard.

Check this out.

boka18
  • 307
  • 2
  • 11
  • I have done that. apache webserver working fine on port 80.but not haproxy. – stalin Sep 23 '18 at 00:51
  • @stalin what does `service haproxy status` return? – boka18 Sep 23 '18 at 00:53
  • ● haproxy.service - HAProxy Load Balancer Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Sun 2018-09-23 01:18:32 UTC; 3s ago Process: 1187 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid $OPTIONS (code=exited, status=1/FAILURE) – stalin Sep 23 '18 at 01:18
  • As you can see `Active: failed`. That means something is wrong with you HAProxy setup. – boka18 Sep 23 '18 at 01:20
  • Thanks .yes i can. let me try if i can fix this. – stalin Sep 23 '18 at 01:22
  • And try to `service haproxy restart` ;) – boka18 Sep 23 '18 at 01:30
  • not able to start it. still it show in failed state. Tired restart still same Active:failed.Tried stop sleep 30 start still same issue. Not sure what went wrong. – stalin Sep 23 '18 at 01:35
  • This should do it: `mkdir /run/haproxy` and then `service haproxy restart` Source: https://stackoverflow.com/questions/46520428/haproxy-fails-to-start – boka18 Sep 23 '18 at 01:44
  • Issue sorted out. Done the above + I was missing backend keyword from my code.Thanks for the help – stalin Sep 23 '18 at 03:06