What is the best way to add a socket to nginx web server?

Ottavio Campana o.campana at videotec.com
Thu Mar 23 12:02:43 UTC 2017

Hello everybody,

I am trying to understand if I can use/change nginx to solve a problem related to a very particular scenario

I have this scenario:

nginx web server <--> router with NAT <--> client running with a public IP address

I cannot configure NAT on the router, so setting port forwarding is not an option.

My idea is to have a small program that starts a TCP connection towards the client and that passes the socket descriptor to the nginx web server.

Basically the whole procedure can be summarized as follows:
1) the helper program, running on the same host of nginx, starts the TCP connection and punch holes the NAT
2) the client accepts the connection
3) the helper program passes the socket descriptor to the nginx web server by using a AF_UNIX socket
4) nginx receives the socket and adds this socket to it set of sockets
5) the client can now start sending HTTP requests to the webserver, as normally

So, the question is: is there a preferred/already existing solution/infrastructure in nginx to do this?

Thank you


More information about the nginx-devel mailing list