There is an nginx web server listening to both 80 and 443 ports. I would like to process all the http requests as usual and forward all the non-http requests to another port (say, 1234).
My question is very similar to one already answered on stackoverflow: Is it possible to forward NON-http connecting request to some other port in nginx?. Perhaps, I misunderstand the most up-voted answer, but when I add something like this to nginx.conf:
stream {
upstream backend {
server example.com:1234;
}
server {
listen 80;
proxy_pass backend;
}
}
I get the (expected) bind() to 0.0.0.0:80 failed (98: Address already in use)
error.