I'm running a server with nginx and fastcgi. I'm using TCP sockets for fastcgi rather than Unix sockets as I've read that this scales better. The fastcgi server is running on fastcgi://127.0.0.1:9000. I'm trying to figure out what rules I need to add to iptables to allow the traffic through. I've figured out this much:
-A INPUT -p tcp -m tcp -d 127.0.0.1 --dport 8999 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp -s 127.0.0.1 --sport 8999 -m state --state NEW,ESTABLISHED -j ACCEPT
But I'm guessing that I should also specify a source port and source IP for the INPUT rule and a destination port and destination IP for the OUTPUT rule (for security purposes). What would the correct values for that be?
I hope that my question makes sense.