Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Let me clarify: I have an iMac wich is wireless connected to the router from the ISP.

The Centos computer is connected to the iMac with a cable and internet sharing is turned on. Installed Nginx on the Centos but I can not get access to it from my iMac.

If I run curl 192.168.3.2 I get connection refused

On my Centos wget 192.168.2.3 is working, because I get the index page from the iMac server running Apache.

Is Centos running a firewall?

EDIT

for the moment I turned off iptables and I can connect, but what I would like to ask now is how to set a rule to allow incoming requests.

share|improve this question
    
"Is Centos running a firewall?" iptables -L will give you a clue about this. –  TAFKA 'goldilocks' Oct 27 '13 at 12:21
    
@goldilocks, thanks I edited my question, I hope for an answer so I can close this question –  Richard Oct 27 '13 at 12:47
add comment

1 Answer

up vote 2 down vote accepted

I would like to ask now is how to set a rule to allow incoming requests.

The easiest way to do that is probably to edit the iptables rules. On CentOS they are probably in /etc/sysconfig/iptables. Make a backup copy of that before you start -- just cp iptables iptables.bk. You will need superuser permissions to access the file, so su root before you do all this.

The file hopefully has comments in it explaining the purpose of various rules; you might look through those to see if there is a line you can uncomment to allow for an HTTP server. If not, add at the top:

-A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT

Hopefully that's enough (if you've used the net at all otherwise with the firewall up, it should be), presuming you are using the normal HTTP port (80).

Now you can restart iptables. If your CentOS uses systemd, systemctl restart iptables, otherwise service iptables restart.

If there's a problem try iptables-restore < /etc/sysconfig/iptables, that will give you a more informative error.

share|improve this answer
    
thanks for the suggestions, that will help –  Richard Oct 27 '13 at 13:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.