Apache...and Virtual Hosts

Giannis Vrentzos gvre at gvre.gr
Thu Nov 18 15:14:09 EET 2004


P at nos wrote:
> Xairete paides....
>  
> Sthn prospatheia mou na egkatastiso apache (2.0.49) ego tis 2 parakato 
> apories....(paizei kanonika o apache apla den mporo na bro ikanopoihtikh 
> apanthsh se auta)
>  
> 1) ston main server dhlonoume to ServerName...auto giati ginetai? gia 
> tupikous logous?
>  
> Kai ekshgoume : exoume 2 pc. o enas me apache server kai o allos o 
> client. Esto oti ston client peirazoume to etc host (gia na mhn trexoume 
> me dns server) oste to www.mainserver.gr <http://www.mainserver.gr> na 
> peftei ston server.... eite baloume ip ston client gia to request, eite 
> baloume www.mainserver.gr <http://www.mainserver.gr> eite exoume kanei 
> allh dhlosh sto etc host dld to www.changed.gr <http://www.changed.gr> 
> na peftei sthn ip tou server tha apanthsei aneksarthtws apo to 
> ServerName.... so? giati to bazoume?

To ServerName to vazeis giati mesa sto http request symperilamvanetai 
kai ayto. Me ayto ton tropo 3erei o apache apo pio directory 8a sou 
servirei selides. Etsi an gia paradeigma exeis thn parakatw dhlwsh:

<VirtualHost 192.168.1.200>
	ServerName www.myvirtualhost.gr
	DocumentRoot /var/www/virtual/www.myvirtualhost.gr
</VirtualHost>

8a dei o apache to ServerName kai 8a sou servirei tis selides pou 
vriskontai mesa sto directory /var/www/virtual/www.myvirtualhost.gr.

> 2) esto dhlono os virtual host to parakato
>  
>         <VirtualHost 192.168.1.200>
>              ServerName www.myvirtualhost.gr 
>              # Other directives go here
>        </VirtualHost>
>  
> giati xreiazetai kai to NameVirtualHost ?? den tha eprepe auto na 
> paizei...tou leei hdh oti an sou zhthsoun to tade servername kai skasei 
> sthn tade ip (192.168.1.200) apanta....

To NameVirtualHost xreiazetai giati yparxei kai to ip based hosting. Sth 
deyterh periptwsh xreiazesai diaforetikh ip gia ka8e hosting pou 
filo3eneis. Mporeis vevaia na exeis kai ta 2 mazi(1 ip gia ola ta name 
based kai apo 1 ip gia ka8e ip based).

> sto Apache Server2 Bible tou Mohhamed Kabir leei to parakato
> * *
> 
> *NameVirtualHost*
> 
> If you plan to use name-based virtual hosts, you need to use the 
> NameVirtualHost directive. Although addr can be the host name, I 
> recommend that you always use an IP address.
> 
> * *
> 
> *Syntax: *NameVirtualHost /addr/[:/port/]
> 
> *Default setting: *None
> 
> * *
> 
> *Context: *Server config
> 
> kati to opoio den mou leei kai polla...Einai san na leei...balte to 
> NameVirtualHost gia namebased virtual host..alla sas protino ki olas na 
> einai ip...

Vazeis ip anti gia onoma gia na glytwseis apo ena resolve.

> 
> (btw to parapano paradeigma den paizei an den balo NameVirtualHost 
> 192.168.1.200)
> 
> kaneis kamia idea?? (eimai sigouros oti tha exete..)
> 
> P at nos <mailto:P at nos> (thxxxx)

Gvre




More information about the Linux-greek-users mailing list