• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 628
  • Last Modified:

Apache virtualhost not working

Hi,

I recently setup a server in our office running centos 6, apache, php, mysql and I've installed webmin.

Up to now it's just been running a site from the standard document root of apache, but last night I tried to setup up a virtual host, first in webmin. The domain name I was using points to the server, but I just get the servers default page. I've tried editing the httpd.conf file manually but even then I can't get the apache to server the folder I want it to server.

Just incase I've set apache as the group and owner of the folder.

I've attached a snipped of my httpd.conf file.

If I uncomment the line;
NameVirtualHost 192.168.24.132:80
I get the following error when I restart apache
[warn] NameVirtualHost 192.168.24.132:80 has no VirtualHosts

Does anyone know why apache wouldn't be serving the site for that specific domain?


#NameVirtualHost 192.168.24.132:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier 
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost mydomain.com>
	DocumentRoot "/var/www/hosts/mydomain.com"
	ServerName mydomain.com
	<Directory "/var/www/hosts/mydomain.com">
	allow from all
	Options +Indexes
	</Directory>
</VirtualHost>

Open in new window

0
SheppardDigital
Asked:
SheppardDigital
  • 2
1 Solution
 
SheppardDigitalAuthor Commented:
I figured this out myself.

It turns out that this line
<VirtualHost mydomain.com>

should have been

<VirtualHost *.80>
0
 
SheppardDigitalAuthor Commented:
Managed to resolve this issue myself
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now