Apache virtualhost not working

Posted on 2011-10-11
Last Modified: 2012-05-12

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;
I get the following error when I restart apache
[warn] NameVirtualHost has no VirtualHosts

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

# 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
#    DocumentRoot /www/docs/
#    ServerName
#    ErrorLog logs/
#    CustomLog logs/ common

	DocumentRoot "/var/www/hosts/"
	<Directory "/var/www/hosts/">
	allow from all
	Options +Indexes

Open in new window

Question by:SheppardDigital

    Accepted Solution

    I figured this out myself.

    It turns out that this line

    should have been

    <VirtualHost *.80>

    Author Closing Comment

    Managed to resolve this issue myself

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
    If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now