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.

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

share|improve this question

2 Answers 2

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

 
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.