Waiting for webapp access

hi all,
how can I manage an API1 CGI web app access queue if there are too many users connected?
or how can I tell there are too many active connections and then deny access to the next user?
thank you.

Use Nginx or HAProxy in front and allow running multiple copies might be an option.