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 recently installed CentOS 5.6 on a server of mine. Looking at the installed packages, i could see the usual, httpd, php, mysql etc

With this in mind, I thought I could simply start httpd (service httpd start) type in the servers, IP address and i'd see the default apache config screen.

But, unfortunately, this doesn't seem to work. I have tried re-installing httpd (yum install httpd) reloading/restart/stopping/starting, but the connection to my server always times out.

I can ping the server, so I know it is actually there and not down/rebooting etc

share|improve this question
    
Was a firewall issue. –  terrid25 Jul 11 '11 at 14:27

4 Answers 4

up vote 4 down vote accepted

Your firewall is probably blocking the connection. You can try to disable it for testing (service iptables stop) or add a rule to allow connections on port 80.

/sbin/iptables -A INPUT -t filter -p tcp --dport 80 -j ACCEPT
share|improve this answer

Do it step by step:

  • Try to access the Apache from the same server, use links or telnet or whatever command line to test it by command line in localhost.
  • If first one works, it means that your Apache installation is OK, next step would be to disable the security and try from the remote host.

    service iptables stop

  • Then try again from the browser. If this works it means that you just need to add a rule to the iptables to allow traffic to port 80 and 443 if you will use it.

  • If it doesn't work there may be a problem with the client (firewall, routes, IP, Proxy), try with another computer

share|improve this answer

[] ping just informs you of Machine State, not of HTTP Server... try 'telnet' to that box at port 80... like below and enter the next two lines when it waits after the command

#telnet CentOS_Box_IP 80

like

Trying CentOS_Box_IP...
Connected to CentOS_Box_IP.
Escape character is '^]'.

then enter

GET / HTTP/1.1
Host: CentOS_BOX_IP

if it sends any kind of HTTP Response that means your HTTP Server is accessible. It'd be like

HTTP/1.1 ...

If it gives output like below, then your HTTP Server might not be started properly or blocked my firewall.

Trying CentOS_Box_IP...
telnet: connect to address CentOS_Box_IP: Connection refused
telnet: Unable to connect to remote host: Connection refused

in such case, look for HTTP Status

#service httpd status

if it returns success, then check for your iptable ruleset.

share|improve this answer

Its better to try the setup command and open the http port and/or other ports you need i recommend you keep mysql closed for the oudside world.

share|improve this answer

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.