1

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.
4
  • Are you running this service as root? Aug 30, 2012 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? Aug 30, 2012 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, 2012 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. Aug 30, 2012 at 21:46

1 Answer 1

3

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.)

1
  • 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 Aug 30, 2012 at 17:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .