2

I am setting up a load balancer in AWS cloud. If I specify the ping path as index.html than the load balancer is working fine, But if I specify any other ping path like index.php, than the ec2 instance becomes out of service.

If i specify index.html as ping path then when I hit the load balancer, apache's default web page opens. But I want that the application should be hit by DNS name of the load balancer only.

Right now I am able to hit the application by typing

DNS_Name/index.php

I want to hit the application as

DNS_name

Thanks

Megha Sharma
  • 2,235
  • 8
  • 27
  • 31

3 Answers3

1

Yes you can.

From the console, click on the load balancer, then health check and 'Edit health check'.

Here, you can change the port, ping path, etc. like so. Just leave the ping path as "/" to hit the root.

enter image description here

Nikhil
  • 3,042
  • 2
  • 16
  • 16
  • Even If i specify the ping path as `/` or `index.php`, it doesnot work.pls help me out – Megha Sharma May 27 '14 at 04:44
  • 1
    The load balancer automatically looks for a response status of 2XX. Are you able to hit / or /index.php on your browser without any errors? The simplest way to check the health is to create a separate endpoint just for the health check and return a simple 200 status with some text. – Nikhil May 27 '14 at 05:07
  • when I put index.html in /var/www/ than it works fine. – Megha Sharma May 27 '14 at 05:18
  • But i want to hit the app with dns name only, how can i achieve this – Megha Sharma May 27 '14 at 05:19
  • the var/www/ has index.html. shoild i remove that for now ? – Megha Sharma May 27 '14 at 05:23
  • The only way the health check will work, is if your page can actually be accessed at the path specified. Does hitting your DNS throw any errors? It seems your issue is more to do with how you've set up your server on your EC2 instance and less with the actual load balancer. – Nikhil May 27 '14 at 05:25
  • yes when i specify / or /index.html the load balancer works perfectly fine. It hite the index.html page, apacheé deafult web page. The ec2 server is an ubuntu server.\ – Megha Sharma May 27 '14 at 05:28
  • I'm a little confused now. If specifying '/' works now, what's the problem? – Nikhil May 27 '14 at 05:53
  • Not sure how that's different from my answer or my first comment, but as long as it works. – Nikhil May 27 '14 at 06:05
1

For others who might run into this kind of problem as I did and here is my solution.

I have an EC2 instance running Nginx while using Django to serve a website.

The Elastic Load Balancer's health check "Ping Path" had to be configured to / for things to work as expected.

Before that it was trying to look for /index.html and was going to the "default" configuration in site-available folder. I deleted that as well as the symbolic link to "default" in site-enabled.

So as the ping path is directing to / and there a page served up by Django the health check passes.

halfer
  • 19,824
  • 17
  • 99
  • 186
samkhan13
  • 3,315
  • 2
  • 33
  • 54
0
  1. Created a blank html file called ping.htm in /var/www.
  2. In the ping path you need to specify :

       ping path : /ping.html
    
Megha Sharma
  • 2,235
  • 8
  • 27
  • 31