apache virtual host problem

Aart Koelewijn aart at mtack.xs4all.nl
Mon Feb 4 20:55:43 UTC 2008


On Mon, 04 Feb 2008 15:15:39 -0500, Ashley Benton wrote:

> I deleted everything, and just left, name server and server alias... in
> the <VirtualHost> </VirtualHost> files.
> The result is the same. I can open the link of the page I moved with
> Windows but not with my computer. When I try to open the page directly
> Firefox and internet explorer they write "can't find the server at
> LinuxAbcd.org" I guess it's because I didn't buy a domain name for this
> two sites. and I will do it later.
> Now If I open (file://www.linuxabcd.org) the Swebsite or linux abcd from
> the computer it is on I see my system directory. If I try to open on the
> windows computer ( http://192.168.0.105/www.linuxabcd.org or
> file://192.168.0.105/www.linuxabcd.org) It says "the requested URL was
> not found on this server" (apache 2.2.4 Ubuntu server at 192,168.0.105
> port 80 The last part I don't understand because when I installed
> apache2 and the first site I was able to open it by writing the private
> IP of the computer before I bought the domain name. Now shouldn't I be
> able to open the other sites with the internal Ip, followed by the
> server name? Does anybody see a reason why I seem to be unable to
> configure more than 1 virtual host?
> Thank you
> Meg
> 
> On Feb 4, 2008 2:09 PM, Ashley Benton <meggalen at gmail.com> wrote:
> 
>> I will try again like you say and delete everything that I put in every
>> other files. I still have one question. Last night I copy my second
>> site main page, put it in the first site folder, and change the links
>> to have the first site open it where it was. It didn't work with my
>> computer using Ubuntu 7.10, but it worked with Windows. If I try to see
>> it with internet explorer and Firefox using Windows it works.
>> If I try to see it using Firefox and Ubuntu 7.10 I can't see neither
>> the links nor the other page?
>> Do I have to put it in the list of file, inside the host configuration?
>> I think I am missing something very easy and important but I have been
>> reading and searching and I didn't find out yet. From what you say I
>> imagine that I don't have to add NameVirtualHost in
>> /etc/apache2/ports.conf. so I will delete it too. I have been trying 
>> some more last night and I am stuck.
>> Thank you for your answer, I will change the files back and let you
>> know the result.
>> Meg
>>
>>
>> On Feb 4, 2008 10:56 AM, Derek Broughton <news at pointerstop.ca> wrote:
>>
>> > Ashley Benton wrote:
>> >
>> > > Sorry I have NameVirtualHost 192.168.0.105 on the first line and
>> > > <VirtualHost 192.168.0.105 > on the second line. Meg
>> >
>> > Karl's leading you astray...
>> >
>> > One only needs NameVirtualHost to specify an IP if you have multiple
>> > interfaces to the Internet.  For this, and almost certainly for your
>> > production version, you want:
>> >
>> > NameVirtualHost *
>> >
>> > <VirtualHost *>
>> >   ServerName example.org
>> >   ...
>> > </VirtualHost>
>> >
>> > <VirtualHost *>
>> >   ServerName another.org
>> >   ...
>> > </VirtualHost>
>> >
>> > From your original mail:
>> >
>> > > I tried to add the following lines in /etc/apache2/http.conf
>> > > ServerName localhost
>> > > ServerName www.example1.com
>> > > ServerName www.example2.com
>> > > ServerName www.Example.org
>> >
>> > That's bad :-)  You want the ServerName directives for each virtual
>> > host _only_ within the <VirtualHost> definition.
>> >
>> > (and we don't ever modify http.conf! - put each virtual host config
>> > in a separate file in /etc/apache2/sites-enabled) --
>> > derek
>> >
>> >
>> > --
>> > ubuntu-users mailing list
>> > ubuntu-users at lists.ubuntu.com
>> > Modify settings or unsubscribe at:
>> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>> >
>> >
>>
> I deleted everything, and just left, name server and server alias... in
> the <VirtualHost> </VirtualHost> files.<br>The result is the
> same. I can open the link of the page I moved with Windows but not with
> my computer. When I try to open the page directly Firefox and internet
> explorer they write "can't find the server at
> LinuxAbcd.org" I guess it's because I didn't buy a domain
> name for this two sites. and I will do it later.<br> Now If I open
> (file://www.linuxabcd.org) the Swebsite or linux abcd from the computer
> it is on I see my system directory.<br>If I try to open on the windows
> computer (<a
> href="http://192.168.0.105/www.linuxabcd.org">http://192.168.0.105/
www.linuxabcd.org</a>
> or file://192.168.0.105/www.linuxabcd.org) It says "the requested
> URL was not found on this server" (apache 2.2.4 Ubuntu server at
> 192,168.0.105 port 80<br> The last part I don't understand because
> when I installed apache2 and the first site I was able to open it by
> writing the private IP of the computer before I bought the domain name.
> Now shouldn't I be able to open the other sites with the internal
> Ip, followed by the server name?<br> Does anybody see a reason why I
> seem to be unable to configure more than 1 virtual host? <br>Thank
> you<br>Meg<br><br><div class="gmail_quote">On Feb 4, 2008 2:09 PM,
> Ashley Benton <<a
> href="mailto:meggalen at gmail.com">meggalen at gmail.com</a>> wrote:<br>
> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
> 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I will try
> again like you say and delete everything that I put in every other
> files. I still have one question. Last night I copy my second site main
> page, put it in the first site folder, and change the links to have the
> first site open it where it was. It didn't work with my computer
> using Ubuntu 7.10, but it worked with Windows.<br>
> 
> If I try to see it with internet explorer and Firefox using Windows it
> works. <br>If I try to see it using Firefox and Ubuntu 7.10 I can't
> see neither the links nor the other page?<br>Do I have to put it in the
> list of file, inside the host configuration? <br>
> 
> I think I am missing something very easy and important but I have been
> reading and searching and I didn't find out yet. <br>From what you
> say I imagine that I don't have to add NameVirtualHost in
> /etc/apache2/ports.conf. so I will delete it too. I have been
> trying  some more last night and I am stuck.<br>
> 
> Thank you for your answer, I will change the files back and let you know
> the result.<br>Meg <div><div></div><div class="Wj3C7c"><br><br><div
> class="gmail_quote">On Feb 4, 2008 10:56 AM, Derek Broughton <<a
> href="mailto:news at pointerstop.ca"
> target="_blank">news at pointerstop.ca</a>> wrote:<br>
> 
> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204,
> 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>Ashley
> Benton wrote:<br><br>> Sorry I have NameVirtualHost <a
> href="http://192.168.0.105" target="_blank">192.168.0.105</a> on the
> first line and<br>
> 
> > <VirtualHost <a href="http://192.168.0.105"
> target="_blank">192.168.0.105</a> > on the second line.<br>>
> Meg<br><br></div>Karl's leading you astray...<br><br>One only needs
> NameVirtualHost to specify an IP if you have multiple<br>
> 
> interfaces to the Internet.  For this, and almost certainly for
> your<br>production version, you want:<br><br>NameVirtualHost
> *<br><br><VirtualHost *><br>   ServerName <a
> href="http://example.org" target="_blank">example.org</a><br>
> 
>    ...<br></VirtualHost><br><br><VirtualHost *><br>
>    ServerName <a href="http://another.org"
>  target="_blank">another.org</a><br>  
>  ...<br></VirtualHost><br><br>From your original mail:<br><div>
> <br>> I tried to add the following lines in
> /etc/apache2/http.conf<br>> ServerName localhost<br>> ServerName
> <a href="http://www.example1.com"
> target="_blank">www.example1.com</a><br>> ServerName <a
> href="http://www.example2.com" target="_blank">www.example2.com</a><br>
> 
> > ServerName <a href="http://www.Example.org"
> target="_blank">www.Example.org</a><br><br></div>That's bad :-)
>  You want the ServerName directives for each virtual host<br>_only_
> within the <VirtualHost> definition.<br>
> 
> <br>(and we don't ever modify http.conf! - put each virtual host
> config in a<br>separate file in
> /etc/apache2/sites-enabled)<br>--<br>derek<br><font
> color="#888888"><br><br>--<br></font><div><div></div><div> ubuntu-users
> mailing list<br><a href="mailto:ubuntu-users at lists.ubuntu.com"
> target="_blank">ubuntu-users at lists.ubuntu.com</a><br>Modify settings or
> unsubscribe at: <a
> href="https://lists.ubuntu.com/mailman/listinfo/ubuntu-users"
> target="_blank">https://lists.ubuntu.com/mailman/listinfo/ubuntu-users</
a><br>
> 
> </div></div></blockquote></div><br>
> </div></div></blockquote></div><br>

Your computers will try to resolve www.linuxabcd.org and will find 
nothing. So in your /etc/hosts file you will have to put:

192.168.0.105 www.linuxabcd.org
192.168.0.105 name.second.domain

to make sure the computer can translate the name to the right (internal) 
IP

Once you have registered the domains and have a official IP for them 
(which points to your server) you can also use a proxy

Aart
Aart





More information about the ubuntu-users mailing list