Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: XAMPP - problem z VirtualHost
Forum PHP.pl > Forum > Serwery WWW
djgrin
Witam.
Zmienilem serwer na XAMPPa (pod WinXP SP2) i chcialem ustawic sobie wirtualki: kilka adresow, ktore beda korzystac z roznych katalogow. Problem polega na tym, ze cokolwiek wpisze w httpd.conf, to apache jakby "widzi" tylko jeden - pierwszy wpis.
Aktualnie moj wpis w httpd.conf wyglada tak (chcialem na poczatek osiagnac cos takiego, ze test.pl wskazuje na katalog test, a localhost na htdocs):

NameVirtualHost *
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs\test"
ServerName test.pl
</VirtualHost>
<VirtualHost _default_>
DocumentRoot "C:\xampp\htdocs"
</VirtualHost>
... i w tym momencie zawsze laduje mi sie strona w katalogu test (bez roznicy czy wpisze localhost czy test.pl).

Czy ktos moze mi powiedziec co robie zle? Moze jakis link do "manuala" albo rozwiazan podobnych problemow?
Z gory dzieki za kazda pomoc winksmiley.jpg.
PS. Oczywiscie w WINDOWS/system32/drivers/ets/hosts odpowiedni wpis poczynilem winksmiley.jpg...
krzyszbi
hej
sam używam xampp-a i mi się podoba a mam poustawiane następujaco
httpd.conf
Kod
<Directory "E:/Krzysiek/www">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

httpd-vhosts.conf
Kod
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "E:/www/localhost"
  <Directory "E:/www/localhost">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName local2
DocumentRoot "E:/www/local2"
  <Directory "E:/www/local2">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName local3
DocumentRoot "E:/www/local3"
  <Directory "E:/www/local3">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


no i pliki C:\WINDOWS\system32\drivers\etc\hosts
Kod
127.0.0.1       localhost
127.0.0.1       local2
127.0.0.1       local1

i u mnie działa jak nie będzie działało napisz co apach krzyczy a razem na pewno uruchomimy
ja mam waśnie wirtualki na localu i je sobie bardzo chwale
gregxp
Cześć
mnie nie działa domena wpisana www.nazwa tzn zrobiłem tak jak w poście wyżej ale niestety nie działa mi nazwa jeśli ją wpisze http://www.nazwadomeny.pl a działa jak wpisze http://nazwadomeny.pl
Proszę o pomoc
webdice
W pliku hosts dodajesz:

Kod
127.0.0.1    nazwadomeny.pl
127.0.0.1    www.nazwadomeny.pl


Poza tym zainteresuj się zmienna konfiguracyjna ServerAlias, dla przykładu:

Kod
ServerAlias nazwadomeny.pl www.nazwadomeny.pl


Zresztą pisałem o tym artykuł na php.pl.
Armstrong
a spróbuj:

Kod
<VirtualHost *:80>
   NameVirtualHost bliskomnie:80
    ServerName bliskomnie2
    DocumentRoot "F:/gargi/-webs/xampp/htdocs/blisko-mnie2"
</VirtualHost>


Gdyby nie zadziałało to pokaż logi apacha
f4ll3ns3raf1n
po uruchomieniu serwera:
Kod
[Thu May 20 13:40:48 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:48 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:48 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:48 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:48 2010] [warn] NameVirtualHost bliskomnie2:80 has no VirtualHosts
[Thu May 20 13:40:49 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:49 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:49 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:49 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:49 2010] [warn] NameVirtualHost bliskomnie2:80 has no VirtualHosts
[Thu May 20 13:40:51 2010] [notice] Digest: generating secret for digest authentication ...
[Thu May 20 13:40:51 2010] [notice] Digest: done
[Thu May 20 13:40:51 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Thu May 20 13:40:51 2010] [notice] Server built: Nov 11 2009 14:29:03
[Thu May 20 13:40:51 2010] [notice] Parent: Created child process 7396
[Thu May 20 13:40:51 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:51 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:51 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:51 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:51 2010] [warn] NameVirtualHost bliskomnie2:80 has no VirtualHosts


po wywołaniu adresu doszło:
Kod
[Thu May 20 13:40:52 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:52 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:52 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:52 2010] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Thu May 20 13:40:52 2010] [warn] NameVirtualHost bliskomnie2:80 has no VirtualHosts
[Thu May 20 13:40:53 2010] [notice] Digest: generating secret for digest authentication ...
[Thu May 20 13:40:53 2010] [notice] Digest: done
[Thu May 20 13:40:54 2010] [notice] Child 7396: Child process is running
[Thu May 20 13:40:54 2010] [notice] Child 7396: Acquired the start mutex.
[Thu May 20 13:40:54 2010] [notice] Child 7396: Starting 150 worker threads.
[Thu May 20 13:40:54 2010] [notice] Child 7396: Starting thread to listen on port 443.
[Thu May 20 13:40:54 2010] [notice] Child 7396: Starting thread to listen on port 80.
[Thu May 20 13:40:54 2010] [notice] Child 7396: Starting thread to listen on port 443.
[Thu May 20 13:40:54 2010] [notice] Child 7396: Starting thread to listen on port 80.




EDIT
ok, nasunąłeś mi rozwiązanie.
dodałem na samym początku pliku httpd-vhosts.conf linijke
Kod
NameVirtualHost *:80


i od tej pory bangla :-)
JoShiMa
Cytat(krzyszbi @ 22.10.2007, 11:28:43 ) *
hej
sam używam xampp-a i mi się podoba a mam poustawiane następujaco
httpd.conf
Kod
<Directory "E:/Krzysiek/www">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

httpd-vhosts.conf
Kod
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "E:/www/localhost"
  <Directory "E:/www/localhost">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName local2
DocumentRoot "E:/www/local2"
  <Directory "E:/www/local2">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName local3
DocumentRoot "E:/www/local3"
  <Directory "E:/www/local3">
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


no i pliki C:\WINDOWS\system32\drivers\etc\hosts
Kod
127.0.0.1       localhost
127.0.0.1       local2
127.0.0.1       local1

i u mnie działa jak nie będzie działało napisz co apach krzyczy a razem na pewno uruchomimy
ja mam waśnie wirtualki na localu i je sobie bardzo chwale


A jak to zrobić w Windows7, gdzie nie ma pliku C:\WINDOWS\system32\drivers\etc\hosts?
erix
Mam Windows7 i upycham ten plik tysiącami wpisów.
JoShiMa
Czy mam rozumieć, że tworzysz sobie brakującą strukturę katalogów i dodajesz ten plik z odpowiednimi wpisami?
erix
On tam jest standardowo, w Twoim systemie widocznie go nie ma (powód mi bliżej nieznany).
JoShiMa
Cytat(erix @ 24.03.2011, 00:42:44 ) *
On tam jest standardowo, w Twoim systemie widocznie go nie ma (powód mi bliżej nieznany).


plik hosts znalazłam w dość dziwnej lokalizacji do której nie mam dostępu z żadnego poziomu.

Zatem uważasz, że powinnam sobie stworzyć to czego brakuje?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.