FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 02-03-2008, 10:34 PM
"Ashley Benton"
 
Default apache virtual host problem

Hi,
I am trying to set up apache2 to see more than one virtual host but don't find my error. Each time I try to see one of the three examples, Apache served me the first site I configured and can't find the others. I tried different ports and it didn't change anything. Your help would be welcome as I don't see what I can add or where to add something or do I need to delete something???

I am using Ubuntu Desktop 7.10 and the 3 sites have been enabled sudo a2ensite example1.com* ,* sudo /etc/init.d/apache2 restart for each one of them separately

This is the base configuration of my files, every different host will have the same thing except for server name, server alias, and root directory.

VirtualHost *
<VirtualHost * >
******* ServerName Example.org
******* ServerAlias Example.org *.Example.org
******* ServerAdmin webmaster@localhost


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

and also add the following to /etc/hosts
127.0.0.1****** localhost
127.0.1.1****** galen-desktop

publicIP(I wrote the number, not publicIP) ** example1.com *.example1.com
publicIP ************************************************** example2.com *.example2.com

publicIP ************************************************** * Example.org *.Example.org

# The following lines are desirable for IPv6 capable hosts
::1**** ip6-localhost ip6-loopback

fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
~************************************************* ************************************************** *******************************************

Apparently, nothing helps. The first site is a web page on internet, the others can be on private network or public, that doesn't really matter at the time. Just one more question, do I need to Buy a DNS if I need them on internet later?* and for now do I need to install bind9 and configure it?

Thank you
Meg ******************************

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-03-2008, 11:25 PM
Karl Auer
 
Default apache virtual host problem

On Sun, 2008-02-03 at 18:34 -0500, Ashley Benton wrote:
> I am trying to set up apache2 to see more than one virtual host but
> don't find my error. Each time I try to see one of the three examples,
> Apache served me the first site I configured and can't find the
> others.

It sounds like you didn't use the NameVirtualHost directive.

...

NameVirtualHost <IP address of server>

...

<VirtualHost <IP address of server>>
...
</VirtualHost>

<VirtualHost <IP address of server>>
...
</VirtualHost>

...


> Just one more question, do I need to Buy a DNS if I need them on
> internet later? and for now do I need to install bind9 and configure
> it?

Name service is needed if you want to find the sites by name. As long as
you are accessing these sites from only one or two machines, you can
use /etc/hosts on those machines, and you can use private addresses.

If you want to go public, and have your sites visible on the Internet,
you will need to obtain public IP addresses, advertise them in the
global DNS, and (obviously) change the Apache config to use those
addresses. A (poor) alternative would be to put the server behind a NAT
and direct all your site names to the same IP address using a dynamic
name server.

Regards, K.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/ +61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at : random.sks.keyserver.penguin.de

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-03-2008, 11:48 PM
"Ashley Benton"
 
Default apache virtual host problem

Ok I tried and changed NameVirtualHost 192.168.0.105* for all virtual hosts and I still got the same result. You can see only the first
* * * * * * * * * * * * * * * ** <NameVirtualHost 192.168.0.105>


page. Every outside connection will come on this address, port 80, and it works with the first site but not the others. Do I have to put a different internal address and how do I tell the computer to add another internal address? Is it because I use the same settings for all virtual hosts that the computer can't find it. I would think it is my problem but I don't know how to solve it.

I tried to put the first with my public IP and the others with 192.168.0.105 but it didn't change the result.
Thanks
Meg


On Feb 3, 2008 7:25 PM, Karl Auer <kauer@biplane.com.au> wrote:

On Sun, 2008-02-03 at 18:34 -0500, Ashley Benton wrote:
> I am trying to set up apache2 to see more than one virtual host but

> don't find my error. Each time I try to see one of the three examples,
> Apache served me the first site I configured and can't find the
> others.

It sounds like you didn't use the NameVirtualHost directive.


* *...

* *NameVirtualHost <IP address of server>

* *...

* *<VirtualHost <IP address of server>>
* * * *...
* *</VirtualHost>

* *<VirtualHost <IP address of server>>

* * * *...
* *</VirtualHost>

* *...


> Just one more question, do I need to Buy a DNS if I need them on
> internet later? *and for now do I need to install bind9 and configure

> it?

Name service is needed if you want to find the sites by name. As long as
you are accessing these sites from only one or two machines, you can
use /etc/hosts on those machines, and you can use private addresses.


If you want to go public, and have your sites visible on the Internet,
you will need to obtain public IP addresses, advertise them in the
global DNS, and (obviously) change the Apache config to use those
addresses. A (poor) alternative would be to put the server behind a NAT

and direct all your site names to the same IP address using a dynamic
name server.

Regards, K.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) * * * * * * * * * +61-2-64957160 (h)

http://www.biplane.com.au/~kauer/ * * * * * * * * *+61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at *: random.sks.keyserver.penguin.de



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-04-2008, 12:22 AM
Karl Auer
 
Default apache virtual host problem

On Sun, 2008-02-03 at 19:48 -0500, Ashley Benton wrote:
> Ok I tried and changed NameVirtualHost 192.168.0.105 for all virtual
> hosts and I still got the same result. You can see only the first
> <NameVirtualHost 192.168.0.105>

Well, you need the NameVirtualHost directive; that specifies the address
of your server. All your named virtual hosts will then specify this
address. Inside the virtualhost you need to specify the name of the
specific site. Something like this:

NameVirtualHost 1.2.3.4

<VirtualHost 1.2.3.4>
DocumentRoot "/path/to/site/data"
ServerName www.mydomain.com
<Directory "/path/to/site/data">
...
</Directory>
</VirtualHost>

> I have to put a different internal address and how do I tell the
> computer to add another internal address?

No, you don't need additional addresses - that is the point of named
virtual hosts. You only need separate addresses if you will be doing
SSL.

> I tried to put the first with my public IP and the others with
> 192.168.0.105 but it didn't change the result.

Not all virtual hosts have to be on the same address. You can have more
than one NameVirtualHost directive and group sites together. In your
case, however, just use one until you have the basics worked out :-)

BTW, next time post your entire config file.

Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/ +61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at : random.sks.keyserver.penguin.de

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-04-2008, 12:33 AM
Karl Auer
 
Default apache virtual host problem

On Sun, 2008-02-03 at 19:48 -0500, Ashley Benton wrote:
> Ok I tried and changed NameVirtualHost 192.168.0.105 for all virtual
> hosts and I still got the same result. You can see only the first
> <NameVirtualHost 192.168.0.105>

Um, you mean "<VirtualHost 192.168.0.105>", right?

You would also have "NameVirtualHost 192.168.0.105" somewhere as a
separate directive, and NOT in angle brackets.

Regards, K.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/ +61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at : random.sks.keyserver.penguin.de

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-04-2008, 12:40 AM
"Ashley Benton"
 
Default apache virtual host problem

Ok I thought that what I had done but apparently not. What would be the address of my server? the IP of the computer over the network which is 192.168.0.105, the 127.0.0.1 which is the hostname or something like that or the public IP. I think I tried them all but I can try again, maybe I missed something. I'd like to know how to find the server address that would avoid me to changed all my files again and again for nothing since I don' t seem to get the basic which is what is my server address.

Yes I have VirtualHost 192.168.0.105 on the first line and <VirtualHost 192.168.0.105 > on the second line. Do I need to write it somewhere else?

Thank you
Meg

On Feb 3, 2008 8:22 PM, Karl Auer <kauer@biplane.com.au> wrote:

On Sun, 2008-02-03 at 19:48 -0500, Ashley Benton wrote:
> Ok I tried and changed NameVirtualHost 192.168.0.105 *for all virtual
> hosts and I still got the same result. You can see only the first

> * * * * * * * * * * * * * * * * *<NameVirtualHost 192.168.0.105>

Well, you need the NameVirtualHost directive; that specifies the address
of your server. All your named virtual hosts will then specify this

address. Inside the virtualhost you need to specify the name of the
specific site. Something like this:

NameVirtualHost 1.2.3.4

<VirtualHost 1.2.3.4>

* DocumentRoot "/path/to/site/data"
* ServerName www.mydomain.com
* <Directory "/path/to/site/data">
* * *...
* </Directory>

</VirtualHost>

> *I have to put a different internal address and how do I tell the
> computer to add another internal address?

No, you don't need additional addresses - that is the point of named

virtual hosts. You only need separate addresses if you will be doing
SSL.

> I tried to put the first with my public IP and the others with
> 192.168.0.105 but it didn't change the result.


Not all virtual hosts have to be on the same address. You can have more
than one NameVirtualHost directive and group sites together. In your
case, however, just use one until you have the basics worked out :-)


BTW, next time post your entire config file.

Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) * * * * * * * * * +61-2-64957160 (h)

http://www.biplane.com.au/~kauer/ * * * * * * * * *+61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at *: random.sks.keyserver.penguin.de



--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-04-2008, 12:44 AM
"Ashley Benton"
 
Default apache virtual host problem

Sorry I have NameVirtualHost 192.168.0.105 on the first line and <VirtualHost 192.168.0.105 > on the second line.
Meg


On Feb 3, 2008 8:40 PM, Ashley Benton <meggalen@gmail.com> wrote:

Ok I thought that what I had done but apparently not. What would be the address of my server? the IP of the computer over the network which is 192.168.0.105, the 127.0.0.1 which is the hostname or something like that or the public IP. I think I tried them all but I can try again, maybe I missed something. I'd like to know how to find the server address that would avoid me to changed all my files again and again for nothing since I don' t seem to get the basic which is what is my server address.


Yes I have VirtualHost 192.168.0.105 on the first line and <VirtualHost 192.168.0.105 > on the second line. Do I need to write it somewhere else?


Thank you
Meg

On Feb 3, 2008 8:22 PM, Karl Auer <kauer@biplane.com.au> wrote:


On Sun, 2008-02-03 at 19:48 -0500, Ashley Benton wrote:
> Ok I tried and changed NameVirtualHost 192.168.0.105 *for all virtual
> hosts and I still got the same result. You can see only the first


> * * * * * * * * * * * * * * * * *<NameVirtualHost 192.168.0.105>

Well, you need the NameVirtualHost directive; that specifies the address
of your server. All your named virtual hosts will then specify this


address. Inside the virtualhost you need to specify the name of the
specific site. Something like this:

NameVirtualHost 1.2.3.4

<VirtualHost 1.2.3.4>


* DocumentRoot "/path/to/site/data"
* ServerName www.mydomain.com
* <Directory "/path/to/site/data">
* * *...
* </Directory>


</VirtualHost>

> *I have to put a different internal address and how do I tell the
> computer to add another internal address?

No, you don't need additional addresses - that is the point of named


virtual hosts. You only need separate addresses if you will be doing
SSL.

> I tried to put the first with my public IP and the others with
> 192.168.0.105 but it didn't change the result.



Not all virtual hosts have to be on the same address. You can have more
than one NameVirtualHost directive and group sites together. In your
case, however, just use one until you have the basics worked out :-)



BTW, next time post your entire config file.

Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) * * * * * * * * * +61-2-64957160 (h)


http://www.biplane.com.au/~kauer/ * * * * * * * * *+61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at *: random.sks.keyserver.penguin.de




--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users







--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-04-2008, 01:11 AM
Karl Auer
 
Default apache virtual host problem

On Sun, 2008-02-03 at 20:40 -0500, Ashley Benton wrote:
> Ok I thought that what I had done but apparently not. What would be
> the address of my server? the IP of the computer over the network
> which is 192.168.0.105, the 127.0.0.1 which is the hostname or
> something like that or the public IP.

Well, it depends where you are coming from! It sounds like you are on a
single public address, with a network of private addresses behind NAT.
For now, get it working inside your network. The address to use would
seem to be 192.168.0.105. Then make sure at least one machine in your
network can resolve the various site names to that one address. So:

site1.mydomain.com = 192.168.0.105
site2.mydomain.com = 192.168.0.105
site3.mydomain.com = 192.168.0.105

Then test from that machine. This can be the same machine as you have
running Apache, if necessary.

> avoid me to changed all my files again and again for nothing since I
> don' t seem to get the basic which is what is my server address.

Once you get it sorted out, a global search-and-replace will do the job.
Until then, though, you will still have to edit files.

> Yes I have VirtualHost 192.168.0.105 on the first line and
> <VirtualHost 192.168.0.105 > on the second line. Do I need to write it
> somewhere else?

Um, you need to pay closer attention. NameVirtualHost is on a line by
itself, it is a global directive and is not inside angle brackets or
inside any other directive:

NameVirtualHost 192.168.0.105

Then you define virtual hosts using this:

<VirtualHost 192.168.0.105>
...
</VirtualHost>

Note the difference between "NameVirtualHost" and "VirtualHost".

I have no idea what you mean by "first line" and "second line". Please
don't explain, just post your entire Apache config. It's hard to debug
through a pinhole.

Regards, K.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) +61-2-64957160 (h)
http://www.biplane.com.au/~kauer/ +61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at : random.sks.keyserver.penguin.de

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-04-2008, 01:35 AM
"Ashley Benton"
 
Default apache virtual host problem

Ok, I added an attachment with the virtual hosts configuration of the second and third site that I can't configure correctly. The second is just a webpage, the third would be moin moin wiki. Until now I have been unable to open it and know if my installation worked, don't even think of working on it, since I can't open it or configure it.I didn't put the first site since it is working.

You said that I had to make sure one machine on my network can resolve the various site names. I didn't touch any of the other computers so do I have to add the files in /etc/hosts ? or somewhere else? Sorry I didn't even think about it but this computer which is where the files are store doesn't open anything except my first site neither so I guessed it comes from something else too.

Thank you for your help
Do you need /etc/apache2/apache2.conf too?

Meg

On Feb 3, 2008 8:44 PM, Ashley Benton <meggalen@gmail.com> wrote:



Sorry I have NameVirtualHost 192.168.0.105 on the first line and <VirtualHost 192.168.0.105 > on the second line.



Meg


On Feb 3, 2008 8:40 PM, Ashley Benton <meggalen@gmail.com> wrote:




Ok I thought that what I had done but apparently not. What would be the address of my server? the IP of the computer over the network which is 192.168.0.105, the 127.0.0.1 which is the hostname or something like that or the public IP. I think I tried them all but I can try again, maybe I missed something. I'd like to know how to find the server address that would avoid me to changed all my files again and again for nothing since I don' t seem to get the basic which is what is my server address.





Yes I have VirtualHost 192.168.0.105 on the first line and <VirtualHost 192.168.0.105 > on the second line. Do I need to write it somewhere else?





Thank you
Meg

On Feb 3, 2008 8:22 PM, Karl Auer <kauer@biplane.com.au> wrote:


On Sun, 2008-02-03 at 19:48 -0500, Ashley Benton wrote:
> Ok I tried and changed NameVirtualHost 192.168.0.105 *for all virtual
> hosts and I still got the same result. You can see only the first





> * * * * * * * * * * * * * * * * *<NameVirtualHost 192.168.0.105>

Well, you need the NameVirtualHost directive; that specifies the address
of your server. All your named virtual hosts will then specify this





address. Inside the virtualhost you need to specify the name of the
specific site. Something like this:

NameVirtualHost 1.2.3.4

<VirtualHost 1.2.3.4>





* DocumentRoot "/path/to/site/data"
* ServerName www.mydomain.com
* <Directory "/path/to/site/data">
* * *...
* </Directory>





</VirtualHost>

> *I have to put a different internal address and how do I tell the
> computer to add another internal address?

No, you don't need additional addresses - that is the point of named





virtual hosts. You only need separate addresses if you will be doing
SSL.

> I tried to put the first with my public IP and the others with
> 192.168.0.105 but it didn't change the result.






Not all virtual hosts have to be on the same address. You can have more
than one NameVirtualHost directive and group sites together. In your
case, however, just use one until you have the basics worked out :-)






BTW, next time post your entire config file.

Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer@biplane.com.au) * * * * * * * * * +61-2-64957160 (h)





http://www.biplane.com.au/~kauer/ * * * * * * * * *+61-428-957160 (mob)

GPG fingerprint: DD23 0DF3 2260 3060 7FEC 5CA8 1AF6 D9E3 CFEE 6B28
Public key at *: random.sks.keyserver.penguin.de







--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users












--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 02-04-2008, 02:56 PM
Derek Broughton
 
Default apache virtual host problem

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@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 12:14 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org