[Apache] Virtual Hosts werken niet

Pagina: 1
Acties:
  • 50 views sinds 30-01-2008

  • urk_forever
  • Registratie: Juni 2001
  • Laatst online: 29-04 11:59
Ik heb apache 1.3.27 hier draaien. In mijn htdocs staat het volgende:

index.php -> laat phpinfo zien
horde -> directory van horde
manual -> directory van apache manual
squidlog -> directory van squidlog pagina

Op mijn machine heb ik het volgende in mijn hosts bestand staan:

192.168.0.205 ba-baracus.a-team.dom
192.168.0.205 imp.a-team.dom
192.168.0.205 squidlog.a-team.dom

Nou wil ik dat als ik ba-baracus.a-team.dom:9090 in mijn browser intyp dat ik dan de index.php met phpinfo krijg te zien en dat werkt ook wel.
Alleen als ik bv imp.a-team.dom:9090 intyp dat ik dan mijn horde krijg, alleen werkt dit niet. Mijn virtual host in mijn httpd.conf ziet er zo uit:

code:
1
2
3
4
5
6
7
8
9
10
11
12
NameVirtualHost imp.a-team.dom

<VirtualHost imp.a-team.dom>
   ServerAdmin xxx@xxx.nl
   DocumentRoot "/usr/local/apache/htdocs/horde"
   ServerName imp.a-team.dom
   ErrorLog /usr/local/apache/logs/error_imp.log
   CustomLog /usr/local/apache/logs/access_imp.log combined

   Alias /horde /usr/local/apache/htdocs/horde
   Alias /horde/ /usr/local/apache/htdocs/horde/
</VirtualHost>


Maar nou krijg ik weer de index.php te zien ipv horde, waarom is dit??

Hail to the king baby!


  • RvdH
  • Registratie: Juni 1999
  • Laatst online: 28-04 08:10

RvdH

Uitvinder van RickRAID

code:
1
2
3
4
5
6
7
8
9
NameVirtualHost 192.168.0.205:9090
<VirtualHost 192.168.0.205:9090>
    ServerName imp.a-team.dom
    ...
</VirtualHost>
<VirtualHost 192.168.0.205:9090>
    ServerName squidlog.a-team.dom
    ....
</VirtualHost>

etc.

  • Sendy
  • Registratie: September 2001
  • Niet online
Inderdaad. probeer het eens met ipnummers. Wellicht kan je voor de ipnummer in de <VirtualHost> * gebruikten. Zo dus
code:
1
2
3
<VirtualHost *>
bla
</VirtualHost>

  • urk_forever
  • Registratie: Juni 2001
  • Laatst online: 29-04 11:59
strlen schreef op 18 November 2002 @ 18:45:
code:
1
2
3
4
5
6
7
8
9
NameVirtualHost 192.168.0.205:9090
<VirtualHost 192.168.0.205:9090>
    ServerName imp.a-team.dom
    ...
</VirtualHost>
<VirtualHost 192.168.0.205:9090>
    ServerName squidlog.a-team.dom
    ....
</VirtualHost>

etc.
Dit werkt niet, ik heb alles zo ingesteld op ip adres, alleen blijft alles bij mijn main server terecht komen!!
Verder nog tips?

Hail to the king baby!


Verwijderd

Wat komt er in je access_log voorbij?

NameVirtualHost 192.168.0.205:9090
<VirtualHost 192.168.0.205:9090>
ServerName imp.a-team.dom
...
</VirtualHost>


This is the way to do it!!! (Natuurlijk wel voor elke host een virtualhost, anders zal hij altijd terugvallen op de eerste)

  • cablepokerface
  • Registratie: Januari 2001
  • Laatst online: 29-01 16:53
Begin eens (het klinkt kinderachtig) met:

'locate httpd.conf'

Om te kijken of er meerdere httpd's op de machine zijn. Als dit zo is moet je ff

'httpd -V' (hoofdletter v)

typen. Daar zie je de HTTPD_ROOT staan en die vertelt je waar de httpds staat die Apache op dat moment gebruikt. Als je er zeker van bent dat je de goede hebt geopend is dit de syntax van een Virtual Host:

NameVirtualHost 0.0.0.0 # Het beste is hier een DNS naam te gebruiken, die wordt nl. geresolved en is constanter dan een IP nummer.

<VirtualHost 0.0.0.0>
ServerAdmin you@email.com
DocumentRoot /home/httpd/html/[DNS naam]
ServerName [DNS naam]
ErrorLog logs/[DNS naam]-error_log
CustomLog logs/[DNS naam]-access_log combined
</VirtualHost>

  • cablepokerface
  • Registratie: Januari 2001
  • Laatst online: 29-01 16:53
Oh ... kzou bijna vergeten ... na het editen van httpd.conf moet je Apache herstarten omdat de httpd.conf gecached wordt bij het starten van Apache. Dus:

'killall -HUP httpd'

Dit veroorzaakt een zogenaamde 'graceful restart' ... Apache zal gelijk weer 'up-and-running' zijn ...

  • urk_forever
  • Registratie: Juni 2001
  • Laatst online: 29-04 11:59
Dit is van vandaag uit mijn access_log:

code:
1
2
3
4
5
6
7
8
9
10
11
192.168.0.250 - - [19/Nov/2002:09:41:50 +0100] "GET / HTTP/1.1" 200 46247
192.168.0.250 - - [19/Nov/2002:09:41:50 +0100] "GET /index.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2974
192.168.0.250 - - [19/Nov/2002:09:41:50 +0100] "GET /index.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 4453
192.168.0.250 - - [19/Nov/2002:09:41:58 +0100] "GET / HTTP/1.1" 200 45856
192.168.0.250 - - [19/Nov/2002:09:41:58 +0100] "GET /index.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2974
192.168.0.250 - - [19/Nov/2002:09:41:59 +0100] "GET /index.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 4453
192.168.0.250 - - [19/Nov/2002:09:42:15 +0100] "GET / HTTP/1.1" 200 46247
192.168.0.250 - - [19/Nov/2002:09:42:15 +0100] "GET /index.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2974
192.168.0.250 - - [19/Nov/2002:09:42:15 +0100] "GET /index.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 4453
192.168.0.250 - - [19/Nov/2002:09:42:20 +0100] "GET /test.php HTTP/1.1" 404 294
192.168.0.250 - - [19/Nov/2002:09:42:30 +0100] "GET /horde/test.php HTTP/1.1" 200 2834


Ik heb maar 1 httpd.conf dus dat gaat goed!! Verder snap ik er ook niks van! Moet ik anders eens mijn complete httpd.conf hier neerzetten?

En ik ben vandaag alleen naar imp.a-team.dom toegegaan!

Hail to the king baby!


Verwijderd

Dus eigenlijk bedoel je zoiets:


NameVirtualHost 192.168.0.205:9090

<VirtualHost 192.168.0.205:9090>
ServerAdmin xxx@xxx.nl
DocumentRoot /usr/local/apache/htdocs
ServerName ba-baracus.a-team.dom
ErrorLog /usr/local/apache/logs/error_ba-baracus.log
CustomLog /usr/local/apache/logs/access_ba-baracus.log combined
</VirtualHost>
<VirtualHost 192.168.0.205:9090>
ServerAdmin xxx@xxx.nl
DocumentRoot /usr/local/apache/htdocs/horde
ServerName imp.a-team.dom
ErrorLog /usr/local/apache/logs/error_imp.log
CustomLog /usr/local/apache/logs/access_imp.log combined
</VirtualHost>

  • urk_forever
  • Registratie: Juni 2001
  • Laatst online: 29-04 11:59
Verwijderd schreef op 19 november 2002 @ 11:45:
Dus eigenlijk bedoel je zoiets:


NameVirtualHost 192.168.0.205:9090

<VirtualHost 192.168.0.205:9090>
ServerAdmin xxx@xxx.nl
DocumentRoot /usr/local/apache/htdocs
ServerName ba-baracus.a-team.dom
ErrorLog /usr/local/apache/logs/error_ba-baracus.log
CustomLog /usr/local/apache/logs/access_ba-baracus.log combined
</VirtualHost>
<VirtualHost 192.168.0.205:9090>
ServerAdmin xxx@xxx.nl
DocumentRoot /usr/local/apache/htdocs/horde
ServerName imp.a-team.dom
ErrorLog /usr/local/apache/logs/error_imp.log
CustomLog /usr/local/apache/logs/access_imp.log combined
</VirtualHost>
Ja, alleen staat dit in men mainserver:

code:
1
2
3
4
5
6
7
<VirtualHost 192.168.0.205:9090>
   ServerAdmin xxx@xxx.nl
   DocumentRoot /usr/local/apache/htdocs
   ServerName ba-baracus.a-team.dom
   ErrorLog /usr/local/apache/logs/error_ba-baracus.log
   CustomLog /usr/local/apache/logs/access_ba-baracus.log combined
</VirtualHost>


De mijne ziet er op dit moment zo uit:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
NameVirtualHost 192.168.0.205:9090

<VirtualHost 192.168.0.205:9090>
   ServerAdmin xxx@xxx.nl
   DocumentRoot /usr/local/apache/htdocs/squidlog
   ServerName squidlog.a-team.dom
   ErrorLog /usr/local/apache/logs/error_ba-baracus.log
   CustomLog /usr/local/apache/logs/access_ba-baracus.log combined
</VirtualHost>
<VirtualHost 192.168.0.205:9090>
   ServerAdmin xxx@xxx.nl
   DocumentRoot /usr/local/apache/htdocs/horde
   ServerName imp.a-team.dom
   ErrorLog /usr/local/apache/logs/error_imp.log
   CustomLog /usr/local/apache/logs/access_imp.log combined
</VirtualHost>


En dat andere staat in de main server deel

Hail to the king baby!


Verwijderd

Staat er toevallig iets van:

<IfDefine Main>
.......
</IfDefine>

Ifso; dan kun je 2 dingen doen:
1 - opstarten mbv de '-D' option.
2 - De 'IfDefine' regels weghalen.

  • urk_forever
  • Registratie: Juni 2001
  • Laatst online: 29-04 11:59
Verwijderd schreef op 19 november 2002 @ 11:58:
Staat er toevallig iets van:

<IfDefine Main>
.......
</IfDefine>

Ifso; dan kun je 2 dingen doen:
1 - opstarten mbv de '-D' option.
2 - De 'IfDefine' regels weghalen.
Thnx voor je hulp, heb mijn fout ondekt! Ik had mijn virtualserver verhaal per ongeluk binnen een IfDefine gezet en daarom werkte het niet!!

Hail to the king baby!


Verwijderd

NameVirtualHost 192.168.0.7:80


<VirtualHost 192.168.0.7>
ServerAdmin postmaster@wirelessnetworking.nl
DocumentRoot d:/web/01
ServerName www.wirelessnetworking.nl
</VirtualHost>

<virtualhost 192.168.0.7>
ServerAdmin postmaster@wirelessnetworking.nl
Documentroot d:/web/02
Servername www.jacqueskouwenhoven.com
</virtualhost>

<virtualhost 192.168.0.7>
ServerAdmin postmaster@wirelessnetworking.nl
Documentroot d:/02
Servername jacqueskouwenhoven.com
</virtualhost>

<virtualhost 192.168.0.7>
ServerAdmin postmaster@wirelessnetworking.nl
Documentroot d:/web/03
Servername www.nonihealth.nl
</virtualhost>

<virtualhost 192.168.0.7>
ServerAdmin postmaster@wirelessnetworking.nl
Documentroot d:/web/03
Servername nonihealth.nl
</virtualhost>

<virtualhost 192.168.0.7>
ServerAdmin postmaster@nonitalk.nl
Documentroot d:/web/04
Servername www.nonitalk.nl
</virtualhost>

<virtualhost 192.168.0.7>
ServerAdmin postmaster@nonitalk.nl
Documentroot d:/web/04
Servername nonitalk.nl
</virtualhost>

Vergeet dan dit niet bovenaan, daardoor ging ik eerst ook de mist in:


NameVirtualHost 192.168.0.7:80

  • moto-moi
  • Registratie: Juli 2001
  • Laatst online: 09-06-2011

moto-moi

Ja, ik haat jou ook :w

Ehmm.. Leuk dat je het verteld enzo, maar ik denk niet dat iemand ruim 10 maanden op een antwoord gaat zitten wachten hoor ;)

God, root, what is difference? | Talga Vassternich | IBM zuigt

Pagina: 1

Dit topic is gesloten.