Apache Server configuration support - Virtual Host Question

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > July 2007 > Virtual Host Question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Virtual Host Question
Computer Guy

2007-07-16, 1:23 am

Hello, I have been signed up to make a neighborhood website. I am
hosting the website on my ubuntu box in my basement which has apache2,
php5, and mysql working great. The only problem I am having now is
that I can't figure out how to set up my virtual host on apache. I
have zoneedit for dynamic dns support. Right now when I go to my
domain name it puts me in /var/www directory (normal document root) I
want it to go to my /var/www/neighborhood directory. I added this to
a file called neighborhood in my sites-enabled directory which is
included in my config file.

NameVirtualHost *:80
<VirtualHost www.*****.com>
ServerAdmin aaron.michalczuk@gmail.com
DocumentRoot /var/www/neighborhood
Servername www.*****.com
</VirtualHost>

I run /etc/init.d/apache2 restart

I get this
apache2: Could not reliably determine the server's fully qualified
domain name, using 127.0.1.1 for ServerName
[Mon Jul 16 00:17:28 2007] [warn] NameVirtualHost *:80 has no
VirtualHosts
apache2: Could not reliably determine the server's fully qualified
domain name, using 127.0.1.1 for ServerName
[Mon Jul 16 00:17:39 2007] [warn] NameVirtualHost *:80 has no
VirtualHosts

[ OK ]


This is my first time trying to use virtual hosts so I am sure there
is a lot of stuff I am doing wrong. Thx in advance.

#2pencil

2007-07-16, 1:22 pm

On Jul 16, 1:21 am, Computer Guy <aaron.michalc...@gmail.com> wrote:
> Hello, I have been signed up to make a neighborhood website. I am
> hosting the website on my ubuntu box in my basement which has apache2,
> php5, and mysql working great. The only problem I am having now is
> that I can't figure out how to set up my virtual host on apache. I
> have zoneedit for dynamic dns support. Right now when I go to my
> domain name it puts me in /var/www directory (normal document root) I
> want it to go to my /var/www/neighborhood directory. I added this to
> a file called neighborhood in my sites-enabled directory which is
> included in my config file.
>
> NameVirtualHost *:80
> <VirtualHost www.*****.com>
> ServerAdmin aaron.michalc...@gmail.com
> DocumentRoot /var/www/neighborhood
> Servername www.*****.com
> </VirtualHost>
>
> I run /etc/init.d/apache2 restart
>
> I get this
> apache2: Could not reliably determine the server's fully qualified
> domain name, using 127.0.1.1 for ServerName
> [Mon Jul 16 00:17:28 2007] [warn] NameVirtualHost *:80 has no
> VirtualHosts
> apache2: Could not reliably determine the server's fully qualified
> domain name, using 127.0.1.1 for ServerName
> [Mon Jul 16 00:17:39 2007] [warn] NameVirtualHost *:80 has no
> VirtualHosts
>
> [ OK ]
>
> This is my first time trying to use virtual hosts so I am sure there
> is a lot of stuff I am doing wrong. Thx in advance.



<VirtualHost 10.1.2.3:80>
ServerAdmin webmaster@host.foo.com
DocumentRoot /www/docs/host.foo.com
ServerName host.foo.com
ErrorLog logs/host.foo.com-error_log
TransferLog logs/host.foo.com-access_log
</VirtualHost>

This information is from http://httpd.apache.org/docs/2.0/mo...tml#virtualhost
as I do not have access to my Virutal Hosts file at this moment. I can
try to help you further when I am again in the office.

-#2pencil-
http://www.akroncdnr.com
http://www.GreatTrainNetwork.com


Computer Guy

2007-07-17, 7:26 pm

On Jul 16, 1:08 pm, #2pencil <number2pen...@gmail.com> wrote:
> On Jul 16, 1:21 am, Computer Guy <aaron.michalc...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> <VirtualHost 10.1.2.3:80>
> ServerAdmin webmas...@host.foo.com
> DocumentRoot /www/docs/host.foo.com
> ServerName host.foo.com
> ErrorLog logs/host.foo.com-error_log
> TransferLog logs/host.foo.com-access_log
> </VirtualHost>
>
> This information is fromhttp://httpd.apache.org/docs/2.0/mod/core.html#virtualhost
> as I do not have access to my Virutal Hosts file at this moment. I can
> try to help you further when I am again in the office.
>
> -#2pencil-http://www.akroncdnr.comhttp://www.GreatTrainNetwork.com


I understand how to do ip virtual hosts, but i am having problems with
my name virtual host. I had already found that documentation on
apache's website, but I could not find a good example about doing a
name based virtual host. Thanks anyways. If anyone else ahs
experience with name based vhosts that would be helpful.

Malcolm

2007-07-18, 1:25 am

On Wed, 18 Jul 2007 00:17:08 -0000
Computer Guy <aaron.michalczuk@gmail.com> wrote:

> On Jul 16, 1:08 pm, #2pencil <number2pen...@gmail.com> wrote:
>=20
> I understand how to do ip virtual hosts, but i am having problems with
> my name virtual host. I had already found that documentation on
> apache's website, but I could not find a good example about doing a
> name based virtual host. Thanks anyways. If anyone else ahs
> experience with name based vhosts that would be helpful.
>=20

Hi
I use DynDNS and have 3 virtual hosts, all I did was add the hostnames
in the hosts file on the ubuntu server and use the following
configuration for them all.

<VirtualHost *>
ServerName www.*****.homeunix.net
ServerAlias *****.homeunix.net *****
DocumentRoot /usr/local/*****

<Directory "/usr/local/*****">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


--=20
Cheers Malcolm =C2=B0=C2=BF=C2=B0 (Linux Counter #276890)
SLED 10.0 SP1 x86_64 Kernel 2.6.16.46-0.14-smp
up 12:09, 4 users, load average: 0.08, 0.10, 0.04
Ian Pawson

2007-07-18, 1:27 pm

Malcolm wrote:
> On Wed, 18 Jul 2007 00:17:08 -0000
> Computer Guy <aaron.michalczuk@gmail.com> wrote:
>
> Hi
> I use DynDNS and have 3 virtual hosts, all I did was add the hostnames
> in the hosts file on the ubuntu server and use the following
> configuration for them all.
>
> <VirtualHost *>
> ServerName www.*****.homeunix.net
> ServerAlias *****.homeunix.net *****
> DocumentRoot /usr/local/*****
>
> <Directory "/usr/local/*****">
> Options FollowSymLinks
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
> </VirtualHost>
>
>

You have to remember to include the 'master' site as a virtual host,
also to add an alias so that 'www.xxxx.com' and just 'xxxx.com' will work

# These are for the virtual hosts on this server
#
NameVirtualHost *:80

# this is for the 'master' web site
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName miniserver
ServerAlias *.miniserver
</VirtualHost>

# this is for the 'xxxx' web site
<VirtualHost *:80>
DocumentRoot "/var/www/html/xxxx"
ServerName xxxx.com
ServerAlias *.xxxx.com
</VirtualHost>

# this is for the 'yyyy' web site
<VirtualHost *:80>
DocumentRoot "/var/www/html/yyyy"
ServerName yyyy.com
ServerAlias *.yyyy.com
</VirtualHost>
SnowBlind

2007-07-18, 7:25 pm

On Tue, 17 Jul 2007 20:02:59 -0500, Malcolm
<malcolm_nospamlewis@bellsouth.net> wrote:

>On Wed, 18 Jul 2007 00:17:08 -0000
>Computer Guy <aaron.michalczuk@gmail.com> wrote:
>
>Hi
>I use DynDNS and have 3 virtual hosts, all I did was add the hostnames
>in the hosts file on the ubuntu server and use the following
>configuration for them all.
>
><VirtualHost *>
> ServerName www.*****.homeunix.net
> ServerAlias *****.homeunix.net *****
> DocumentRoot /usr/local/*****
>
> <Directory "/usr/local/*****">
> Options FollowSymLinks
> AllowOverride All
> Order allow,deny
> Allow from all
> </Directory>
></VirtualHost>


I know this works for me on Apache 2 using Named Virtual Hosts.

Check that this line is not #'d in your httpd.conf file.

Include conf/extra/httpd-vhosts.conf
(check that the path is correct for your setup)

Then open your virtual hosts file as referenced above.
Check that the following line is not #'d as in the example below.

NameVirtualHost *:80

(NOTE: there is no IP since this is not required for Named Virtual
Hosts, but the port is needed for some odd reason , If you need to
use different IPs then use the IP for each host and be sure there is
an Eth0, Eth1, for each host since each requires it's own assigned
network interface to listen on AFAIK.

Then check that the below directives are set for each domain.

<VirtualHost *:80> (again with the IP thing above)
ServerAdmin admin@domain01.com
DocumentRoot /apache/html/domain01.com
(set this to your path)
ServerName www.domain01.com
ServerAlias domain01.com
ErrorLog /apache/logs/domain01error.log
(set this to your path)
CustomLog /apache/logs/domain01access.log combined
(set this to your path)
</VirtualHost>

(repeat for each domain. FYI you don't need both logs but I use them
both so I can sort through the bs easier and to analyze the combined
log with AwStats.)

You could also put all these directives in your conf file if you like,
the way it is with Apache 1. Then be sure all permissions are set for
each directory according to your needs and security issues. Also you
didn't mention this but you need to be sure that DNS points to the
right place. Each domain needs a fully qualified domain name
(www.domain01.com), meaning it needs to have a dns record that points
to http://www.domain01.com and gives the proper IP address so that the
browser and server can find each other. Else a DNS lookup will fail to
find any info for the domain and the host won't be able to sort the
requests properly.

Apache is like my old '70 VW Beatle, it's harder to to make it NOT
work than it is to make it run well. If you can follow the 100s of
thousands of How-To's on the web then it's really much easier than
some may believe.
Your Best Friend

2007-07-19, 1:22 pm

I also want to find how to perform a virtual host using a .htaccess
file, if it's possible.

Computer Guy wrote:
> On Jul 16, 1:08 pm, #2pencil <number2pen...@gmail.com> wrote:
>
> I understand how to do ip virtual hosts, but i am having problems with
> my name virtual host. I had already found that documentation on
> apache's website, but I could not find a good example about doing a
> name based virtual host. Thanks anyways. If anyone else ahs
> experience with name based vhosts that would be helpful.
>


--
Thanks,
Bryan K
bk@bkworksproducts.com.info
To reply, remove .com
** PROUD USER OF THUNDERBIRD **
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com