Friday, February 6, 2015

centos - cannot connect to my nginx server from remote machine



I thought that it's iptables problem.. but it seems not.
I really have no idea about this situation.



I'm getting a server hosting(CentOS).
I installed Nginx + Django and nginx uses 8080 port.
A domain is connected to the server.




When I executed "wget [domain]:8080/[app name]/" in the server,
it worked.
Of course, "wget 127.0.0.1:8080/[app name]/" has no problem.
(wget [server ip]:8080/[app name]/, either)



However, from other computers, connecting was failed.
(message says, no route)



I checked my firewall setting.

I excuted these commands.



 iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -I OUTPUT -p tcp --sport 8080 -j ACCEPT
iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
/etc/init.d/iptables restart


I don't really understand all options of commands and I think there were useless commands, but I just tried all googled iptables settings.




But still I cannot connect to my server.
What should I check, first?



I don't know this is important, but add to this post.
On 80 port, an apache server is running.
It works fine, I can connect to apache from other computers.
There is DB connecting issue, (PHP to MySQL) but I think that it is just PHP coding bug.



please excuse my low-level English.
I'm not native English speaker..

but I tried to explane well as far as possible.
Thank you for reading this question.


Answer



shut down your fw, flush all rules and retry your remote connections




  • if you can connect -> adjust your firewall

  • if you cant connect -> ajdust your routing




you can see check with tcpdump port 8080 on your server, if packages are arriving.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...