Results 1 to 8 of 8
I am a newbie to linux and in particular working with apache and server side software and have a problem configuring virtual hosts.
I added entries to the hosts file ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-17-2011 #1Just Joined!
- Join Date
- May 2010
- Posts
- 11
virtual hosts error/ NameVirtualHost *:80 has no VirtualHosts
I am a newbie to linux and in particular working with apache and server side software and have a problem configuring virtual hosts.
I added entries to the hosts file to reflect the virtual sites I want to run on the server
Following a college tutorial I opened /etc/apache2/sites-available and renamed the default file as default.old and created a document named default and inserted the following
NameVirtualHost 192.168.40.138
<VirtualHost 192.168.40.138>
*** ServerAdmin webmaster"site1.com
*** DocumentRoot /var/www/
*** ServerName 192.168.40.138
<Directory /var/www/>
*** *** Options Indexes FollowSymLinks Multiviews +Includes
*** *** AllowOverride None
*** *** Order allow,deny
*** *** XBitHack On
*** </Directory>
</VirtualHost>
##Entry for site1.com
<VirtualHost 192.168.40.138>
*** ServerAdmin webmaster"site1.com
*** DocumentRoot /var/www/site1.com
*** ServerName site1.com
</VirtualHost>
##Entry for site2.com
<VirtualHost 192.168.40.138>
*** ServerAdmin webmaster"site2.com
*** DocumentRoot /var/www/site2.com
*** ServerName site2.com
</VirtualHost>
The next step is to run apache2ctl graceful and after I do I get the error message of [Mon Jan 17 11:08:37 2011] [warn] NameVirtualHost *:80 has no VirtualHosts
Anyone got any suggestions, help would be appreciated.
For the purpose of posting with less than 15 posts I had to change *** ServerAdmin webmaster"site2.com and replace the @ with a " to be able to post.
- 01-17-2011 #2
Add a :80 to NameVirtualHost and all the VirtualHosts.
aka:
NameVirtualHost 192.168.40.138:80
<VirtualHost 192.168.40.138:80>
Also, grep for conflicting NameVirtualHosts directives.
On a side note:
Is it intended, that the files of *all* sites are available via the first host?
Depending on the environment/use case this is a security hole.You must always face the curtain with a bow.
- 01-17-2011 #3Just Joined!
- Join Date
- May 2010
- Posts
- 11
Thanks for the reply, I followed your advice and added :80 to NameVirtualHost and all the VirtualHosts. After running apache2ctl graceful I am still getting the [Mon Jan 17 11:45:53 2011] [warn] NameVirtualHost *:80 has no VirtualHosts.
It is a test, security isn't an issue at the moment to be honest I just want to learn how to set up and run a basic server then try more intensive things like security and monitoring server usage.
- 01-17-2011 #4
Did you grep for conflicting NameVirtualHost ?
Another thing, the "***" indicate white spaces, not actually "***"?You must always face the curtain with a bow.
- 01-17-2011 #5Just Joined!
- Join Date
- May 2010
- Posts
- 11
- 01-17-2011 #6
cd /etc/apache2
grep -ri namevirtualhost *You must always face the curtain with a bow.
- 01-17-2011 #7Just Joined!
- Join Date
- May 2010
- Posts
- 11
- 01-17-2011 #8
That grep will search all files for namevirtualhost recursively and case-insensitive.
And yes, change to /etc/apache2 before.
The grep should come back almost instantly, as the amount of files in that apache configdirectory is usually fairly small.You must always face the curtain with a bow.


Reply With Quote

