Domain – How to setup virtualhost for domain on CentOs 6.2 using apache2

apache-2.2centos6domainvirtualhost

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 mydomain.com 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:

127.0.0.1      mydomain.com

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>

<VirtualHost *:80>
        ServerName mydomain.com
        ServerAlias www.mydomain.com
        ServerAdmin myemailaddress@email.com
        DocumentRoot /var/www/html/mydomain.com
        <Directory "/var/www/html/mydomain.com">
                Options Includes FollowSymLinks
                AllowOverride All
                allow from all
        </Directory>
        ErrorLog /var/www/logs/mydopmain.com.default.log
</VirtualHost>

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/mydomain.com 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 mydomain.com 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

Best Answer

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
Related Topic