[SOLVED] Help with setting up virtual hosts please!

Support for webhosts that use CentOS

[SOLVED] Help with setting up virtual hosts please!

Postby AlexGatti » 2012/02/06 19:56:55

Hello,

I'm trying to run multiple websites off of my server so I set up a virtual host in the httpd.conf files.
I already checked with my server host and they say the DNS is set up corrently.
When I try to goto my website the web browser says it cannot be found.

This is what I put in my httpd.conf

NameVirtualHost *:80

ServerAdmin alexgatti@msn.com
DocumentRoot /etc/httpd/www/alexandergatti.com
ServerName alexandergatti.com


Could anyone tell me what I am doing wrong? This is on a fresh CentOS install.

Thank you for any help,
Alexander Gatti
AlexGatti
 
Posts: 6
Joined: 2012/02/06 19:51:55

[SOLVED] Help with setting up virtual hosts please!

Postby pschaff » 2012/02/06 20:36:20

Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature.

See the Deployment Guide: Setting Up Virtual Hosts.

To activate name-based virtual hosting, uncomment the NameVirtualHost line by removing the hash mark (#) and [color=ff0000]replace the asterisk (*) with the IP address assigned to the machine[/color].
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: Help with setting up virtual hosts please!

Postby AlexGatti » 2012/02/06 20:45:05

I have put the IP adress in but am still unable to goto the website the httpd.conf now reads

NameVirtualHost 206.217.197.127:80

ServerAdmin alexgatti@msn.com
DocumentRoot /etc/httpd/www/alexandergatti.com
ServerName alexandergatti.com


Are there settings somewhere else that I need to change for this to work?
It still says can't connect to server when I try to goto the site?
AlexGatti
 
Posts: 6
Joined: 2012/02/06 19:51:55

Re: Help with setting up virtual hosts please!

Postby pschaff » 2012/02/06 21:01:55

Have you opened port 80 in the firewall? Are you seeing any SELinux denials? Anything relevant in the logs? Exactly what error[s] are you seeing when trying to connect?
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: Help with setting up virtual hosts please!

Postby AlexGatti » 2012/02/06 21:23:30

This is the error I get:

Oops! Internet Explorer could not connect to alexandergatti.com

I added the following line to iptables to try and open the port:

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

After I added the line and restarted iptables I got an error:

Applying iptables firewall rules: ip_tables: (c) Netfilter Core Team
Netfilter messages via NETLINK v0.30
ip_conntrack version 2.4 (8192 buckets, 65536 max) - 304 bytes per conntrack
iptables-restore: line 25 failed

I'm guessing line 25 is the one I added.
I've been doing web design for awhile but this is my first attempt at administering a CentOS server. Are you there any books you would recomend for someone new to CentOS administration?
AlexGatti
 
Posts: 6
Joined: 2012/02/06 19:51:55

Re: Help with setting up virtual hosts please!

Postby AlexGatti » 2012/02/06 22:26:09

Okay I changed the iptable settings to
-A INPUT -p tcp --dport 80 -j ACCEPT

And was able to restart iptables successfully but am still unable to conect to my websites.
AlexGatti
 
Posts: 6
Joined: 2012/02/06 19:51:55

Re: Help with setting up virtual hosts please!

Postby pschaff » 2012/02/06 22:57:35

Firewall rules depend on the order. Try temporarily disabling the firewall - "service iptables stop".

There are book listed in the recommended reading. I don't have any additional personal recommendations.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: Help with setting up virtual hosts please!

Postby AlexGatti » 2012/02/08 00:33:11

Ok disabling the firewall worked. So, should I place the port exception at the top of the iptables file? Also, I keep using "/sbin/service iptables save" to save the tables but each time I open them again I find that the exceptions I played in it are no longer there.
AlexGatti
 
Posts: 6
Joined: 2012/02/06 19:51:55

Re: Help with setting up virtual hosts please!

Postby pschaff » 2012/02/08 20:07:13

Have you tried using system-config-securitylevel?
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: Help with setting up virtual hosts please!

Postby AlexGatti » 2012/02/12 02:44:29

Thank you! I have it working now.
AlexGatti
 
Posts: 6
Joined: 2012/02/06 19:51:55

Next

Return to CentOS 5 - Webhosting Support

Who is online

Users browsing this forum: No registered users and 1 guest