Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First time LAMP and domain setup on CentOs. Previous experience of this is in Ubuntu. Working on a dedicated server package of my local ISP. They installed default CentOs 6.2 and redirected my domain to the server. Pinging works fine to reach the server's IP.

I have successfully installed LAMP on the box using this howto explanation. All seems fine.

I have edited /etc/hosts:

I have also edited the /etc/httpd/conf/httpd.conf and added the following at the end of the file, while keeping the rest default:

NameVirtualHost *:80

<VirtualHost *:80>
   DocumentRoot /var/www/html
   ServerName localhost

<VirtualHost *:80>
        DocumentRoot /var/www/html/
        <Directory "/var/www/html/">
                Options Includes FollowSymLinks
                AllowOverride All
                allow from all
        ErrorLog /var/www/logs/

And i also ran

chmod -R apache:apache /var/www/html

as a final attempt to get things going.

Both /var/www/html and /var/www/html/ contain a basic index.php so that i can test that everything works.

The problem i get is when i try access the domain via the browser i get an "The connection has timed out: The server at is taking too long to respond."

Ubuntu used the sites-available and sites-enabled, so i am not sure if i am missing a setup somewhere or if something is missing from the ISP side?

Does anyone know how to setup virtualHosts on CentOs 6.2 for apache2?

Thank you, David

share|improve this question
up vote 3 down vote accepted

Verify that Apache is actually running:

ps -FC httpd

And listening on port 80:

sudo netstat -tlnp | grep httpd

And that you've allowed connections to port 80:

sudo system-config-firewall-tui
share|improve this answer
Many Thanks! After installing and using 'system-config-firewall-tui' I found that only SSH access was allowed but not HTTP. Enabling HTTP lead to my main index.php loading with success. So on to the next thing to get running! :P – ddtpoison777 Jun 26 '12 at 18:11

I believe CentOS has a firewall enabled by default. 'sudo /sbin/service iptables off' to completely disable it (this has security implications!).

When using name-based virtual hosting, if there is a name mismatch, the first defined virtual host will be used.

share|improve this answer

Your Answer


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.