3

I am trying to make it so my default server only allows access to one PHP file for AWS ELB's health check. I need PHP to serve it so it knows PHP is up/running on the instance. I am able to do the following to deny access with a 403:

server {
    listen 443 ssl;

    location /path/elb.php {
        fastcgi_param SCRIPT_FILENAME /path/to/elb.php;
        include fastcgi.conf;
        allow all;
    }

    deny all;
}

However, ideally I want to use return 444; instead of deny all;. It appears that using return 444; supersedes the location statement above it, as it will not work. Any suggestions, or is using deny all; the best I will get in my scenario?

Thanks!

square
  • 77
  • 1
  • 5

1 Answers1

3

Just wrap return into location.

location / {
    return 444;
}

But actually I don't see why you would want this.

Alexey Ten
  • 13,794
  • 6
  • 44
  • 54
  • This worked! Thanks for your suggestion -- I didn't think to wrap the return into location. – square Apr 13 '16 at 07:19