Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have custom webserver that i want to run on 80 port. The problem is its being blocked by selinux. So from localhost I can browse the site, but from outer world its not accessible.

I run the program this way,

   /opt/project1/run.py -p 80.
share|improve this question
    
Are you running this service as root? –  Tim Brigham Aug 30 '12 at 16:39
    
Yes, But later I'll run it under a user. May be sudo -u usename /opt/project1/run.py -p 80 will do it? –  Shiplu Aug 30 '12 at 17:19
    
Only root can bind to "privileged ports" on UNIX systems, that is ports under 1024. A typical practice is to handle incoming connections as root, then fork to a handler process running as a non-privileged user. –  Kyle Smith Aug 30 '12 at 17:35
    
@KyleSmith I think you didn't get the point of my question. I am not saying I can not bind it. I can bind. Problem is its only accessible from local host but not from outer world. –  Shiplu Aug 30 '12 at 21:46

1 Answer 1

up vote 3 down vote accepted

Are you certain it's selinux that blocks this from working, and not either:

  • The software firewall, iptables. Take a look at the output of iptables -nvL to see what rules are applied.

  • The way the server listens for incoming connections. (This is typically handled by binding to a specific address. For example, if you are binding to listen on 127.0.0.1:80, you cannot accept connections from anywhere except localhost.)

share|improve this answer
    
Thanks for pointing me out. It was indeed firewall issue. BTW, I bind it to 0.0.0.0:80. I can see that by netstat –  Shiplu Aug 30 '12 at 17:17

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.