2. virtueller Server funktioniert nicht

Irgendwelche Probleme mit XAMPP für Windows? Dann ist hier genau der richtige Ort um nachzufragen.

2. virtueller Server funktioniert nicht

Postby priga » 11. August 2016 17:55

Hallo,
ich habe mir heute auf meinem neuen Rechner xampp installiert. Um die Entwicklungsumgebung meines alten Rechners nachzubauen, habe ich einen 2. virtuellen Server anlegen wollen.
Dazu habe ich in der Datei C:\Windows\system32\drivers\etc in die hosts-Datei folgendes geschrieben:
Code: Select all
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

   127.0.0.1   localhost
   127.0.0.1   localhero



und in die httpd-vhosts.conf unter C:\xampp\apache\conf\extra habe ich dieses geschrieben:
Code: Select all
# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
    ##ServerName dummy-host.example.com
    ##ServerAlias www.dummy-host.example.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>


<VirtualHost *:80>
       DocumentRoot "C:/xampp/htdocs/"
       ServerName localhost
</VirtualHost>
<VirtualHost *:80>
       DocumentRoot "C:/xampp/htdocs2"
       ServerName localhero
</VirtualHost>



Alle Dateien für localhost liegen unter htdocs, die Dateien für meinen 2. virtuellen Server liegen im Ordner htdocs2.

Soweit die Therorie. Leider funktioniert es nicht und ich bekomme beim Aufruf von localhero (also dem 2. Server) immer einen Seiten-Ladefehler.
Fehlermeldung:
Fehler: Verbindung fehlgeschlagen

Firefox kann keine Verbindung zu dem Server unter localhero aufbauen.

Die Website könnte vorübergehend nicht erreichbar sein, versuchen Sie es bitte später nochmals.
Wenn Sie auch keine andere Website aufrufen können, überprüfen Sie bitte die Netzwerk-/Internetverbindung.
Wenn Ihr Computer oder Netzwerk von einer Firewall oder einem Proxy geschützt wird, stellen Sie bitte sicher, dass Firefox auf das Internet zugreifen darf.


Weiß hier jemand, woran das liegen könnte???

Danke, priga
priga
 
Posts: 6
Joined: 11. August 2016 17:41
XAMPP version: 5.6.23
Operating System: Windows 10

Re: 2. virtueller Server funktioniert nicht

Postby Altrea » 11. August 2016 18:28

Hallo,

Hast du Apache nach der Änderung auch neugestartet?
Öffne mal bitte eine Eingabeaufforderung, navigiere ins Apache bin Verzeichnis und rufe folgendes auf:
Code: Select all
httpd -S


mit freundlichen Grüßen,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: 2. virtueller Server funktioniert nicht

Postby Nobbie » 11. August 2016 18:30

Die Fehlermeldung bedeutet in jedem Fall, dass es NICHT an Xampp liegt. Aus irgendeinem Grund wird der Server localhero erst gar nicht gefunden. Wenn localhost aber läuft (wovon ich ausgehe, oder geht das auch nicht?!), dann funktioniert zwar Xampp, aber irgendetwas stimmt in Windows nicht.

Versuche mal in einem Terminal (DOS Box), ob "ping localhero" funktioniert.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: 2. virtueller Server funktioniert nicht

Postby priga » 11. August 2016 19:19

Hallo, vielen Dank für die Antworten.

Apache hatte ich mehrfach neugestartet (einzeln oder als Dienst), genauso wie den Rechner *hilflos*.
localhost kann ich aufrufen, kein Problem.

Nach der Eingabe von httpd -3 habe ich folgendes erhalten:
Code: Select all
C:\xampp\apache\bin>httpd -3
httpd: illegal option -- 3
Usage: httpd [-D name] [-d directory] [-f file]
             [-C "directive"] [-c "directive"]
             [-w] [-k start|restart|stop|shutdown] [-n service_name]
             [-k install|config|uninstall] [-n service_name]
             [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -n name            : set service name and use its ServerConfigFile and ServerRoot
  -k start           : tell Apache to start
  -k restart         : tell running Apache to do a graceful restart
  -k stop|shutdown   : tell running Apache to shutdown
  -k install         : install an Apache service
  -k config          : change startup Options of an Apache service
  -k uninstall       : uninstall an Apache service
  -w                 : hold open the console window on error
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed vhost settings
  -t -D DUMP_RUN_CFG : show parsed run settings
  -S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
  -t -D DUMP_MODULES : show all loaded modules
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check
  -X                 : debug mode (only one worker, do not detach)


Damit kann ich allerdings gar nichts anfangen, sorry.


Der Ping zu localhero funktioniert:
Code: Select all
Ping wird ausgeführt für localhero [127.0.0.1] mit 32 Bytes Daten:
Antwort von 127.0.0.1: Bytes=32 Zeit<1ms TTL=128
Antwort von 127.0.0.1: Bytes=32 Zeit<1ms TTL=128
Antwort von 127.0.0.1: Bytes=32 Zeit<1ms TTL=128
Antwort von 127.0.0.1: Bytes=32 Zeit<1ms TTL=128

Ping-Statistik für 127.0.0.1:
    Pakete: Gesendet = 4, Empfangen = 4, Verloren = 0
    (0% Verlust),
Ca. Zeitangaben in Millisek.:
    Minimum = 0ms, Maximum = 0ms, Mittelwert = 0ms


Vielen Dank schon mal
priga
priga
 
Posts: 6
Joined: 11. August 2016 17:41
XAMPP version: 5.6.23
Operating System: Windows 10

Re: 2. virtueller Server funktioniert nicht

Postby Altrea » 11. August 2016 19:24

httpd -S

(S wie Siegfried)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: 2. virtueller Server funktioniert nicht

Postby priga » 11. August 2016 19:47

Ooops, falsch gelesen.
bei httpd -S kommt folgendes:
Code: Select all
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:45)
         port 80 namevhost localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:45)
         port 80 namevhost localhero (C:/xampp/apache/conf/extra/httpd-vhosts.conf:58)
*:443                  www.example.com (C:/xampp/apache/conf/extra/httpd-ssl.conf:121)
ServerRoot: "C:/xampp/apache"
Main DocumentRoot: "C:/xampp/htdocs"
Main ErrorLog: "C:/xampp/apache/logs/error.log"
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="C:/xampp/apache/logs/" mechanism=default
PidFile: "C:/xampp/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG

C:\xampp\apache\bin>


Als Fehlermeldung erhalte ich jetzt:
Zugriff verweigert!

Der Zugriff auf das angeforderte Verzeichnis ist nicht möglich. Entweder ist kein Index-Dokument vorhanden oder das Verzeichnis ist zugriffsgeschützt.

Sofern Sie dies für eine Fehlfunktion des Servers halten, informieren Sie bitte den Webmaster hierüber.
Error 403
localhero
Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.23


Bringt euch das weiter?

Danke, danke
priga
 
Posts: 6
Joined: 11. August 2016 17:41
XAMPP version: 5.6.23
Operating System: Windows 10

Re: 2. virtueller Server funktioniert nicht

Postby Nobbie » 11. August 2016 19:56

priga wrote:Bringt euch das weiter?


Ja und nein.

Ja: die Ursache liegt darin, dass Du keinerlei Rechte für Apache im VirtualHost festgelegt hast (Stichwort: Require all granted).

Nein: diese Fehlermeldung hat eine vollkommene andere Ursache und Lösung als die erstgenannte Fehlermeldung. Du hast zwangsläufig irgendwo irgendetwas geändert, aber hier nicht mitgeteilt. Das macht es für uns nur noch schwerer, als es ohnehin schon ist.

Insgesamt siehe Antwort "Ja". Du musst den VirtualHost um die notwendigen Rechte erweitern (im Zweifel siehe Google).
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: 2. virtueller Server funktioniert nicht

Postby priga » 11. August 2016 20:05

Ich habe genau das geändert, nämlich die Rechte.
Ich habe jetzt in der httpd-vhosts.conf stehen:
Code: Select all
# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
    ##ServerName dummy-host.example.com
    ##ServerAlias www.dummy-host.example.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>


<VirtualHost *:80>

   ServerName localhost
   DocumentRoot C:/xampp/htdocs/

<Directory "C:/xampp/htdocs/">
   Order Allow,Deny
   Allow from all
</Directory>

</VirtualHost>


<VirtualHost *:80>

   ServerName localhero
   DocumentRoot C:/xampp/htdocs2

<Directory "C:/xampp/htdocs2/">
   Order Allow,Deny
   Allow from all
</Directory>

</VirtualHost>



bei der httpd -S Abfrage erhalte ich jetzt:
Code: Select all
C:\xampp\apache\bin>httpd -S
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:45)
         port 80 namevhost localhost (C:/xampp/apache/conf/extra/httpd-vhosts.conf:45)
         port 80 namevhost localhero (C:/xampp/apache/conf/extra/httpd-vhosts.conf:58)
*:443                  www.example.com (C:/xampp/apache/conf/extra/httpd-ssl.conf:121)
ServerRoot: "C:/xampp/apache"
Main DocumentRoot: "C:/xampp/htdocs"
Main ErrorLog: "C:/xampp/apache/logs/error.log"
Mutex default: dir="C:/xampp/apache/logs/" mechanism=default
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
PidFile: "C:/xampp/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG

Außerdem habe ich vorsichtshalber noch eine index.html in den localhero-Ordner (htdocs2) gelegt.
Hat aber auch nix gebracht.

Danke noch mal
priga
 
Posts: 6
Joined: 11. August 2016 17:41
XAMPP version: 5.6.23
Operating System: Windows 10

Re: 2. virtueller Server funktioniert nicht

Postby Nobbie » 11. August 2016 20:11

Siehst Du in Deiner Konfiguration irgendwo "Require All Granted" (das hatte ich ja explizit vorgegeben)? Nö.

Ich gebe auf.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: 2. virtueller Server funktioniert nicht

Postby Altrea » 11. August 2016 20:39

Du kommst offenbar von älteren Apache 2.2 Konfigurationen bzw. ziehst dein Wissen aus veralteten Tutorials.
Apache 2.4 hat einiges an der Syntax für die Zugangskontrolle geändert. Order und Allow from/Deny from gibt es so nicht mehr in der Standardbibliothek.
Wie Nobbie schon gesagt hat suche mal nach Require all granted und lies dir da ein bißchen was an, dann klappts auch mit dem Nachbar(host) :D
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: 2. virtueller Server funktioniert nicht

Postby priga » 12. August 2016 14:34

Hallo nochmal,

ich habe die httpd-vhosts.conf jetzt entsprechend geändert. Leider ohne Erfolg.
In der Datei steht jetzt:
Code: Select all
<VirtualHost *:80>

   ServerName localhost
   DocumentRoot C:/xampp/htdocs/

<Directory "c:/xampp/htdocs/">
   AllowOverride All
   Require all Granted
</Directory>

</VirtualHost>


<VirtualHost *:80>

   ServerName localhero
   DocumentRoot C:/xampp/htdocs2

<Directory "c:/xampp/htdocs2/">
   AllowOverride All
   Require all Granted
</Directory>

</VirtualHost>


Der Zugriff ist weiterhin verweigert (403).

Irgendwelche Ideen?
priga
 
Posts: 6
Joined: 11. August 2016 17:41
XAMPP version: 5.6.23
Operating System: Windows 10

Re: 2. virtueller Server funktioniert nicht

Postby priga » 12. August 2016 14:48

Ich schiebe noch mal das error.log ein:
Code: Select all
[Fri Aug 12 15:32:44.357213 2016] [core:warn] [pid 9604:tid 520] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Aug 12 15:32:44.412358 2016] [ssl:warn] [pid 9604:tid 520] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 12 15:32:44.505654 2016] [mpm_winnt:notice] [pid 9604:tid 520] AH00455: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.23 configured -- resuming normal operations
[Fri Aug 12 15:32:44.505654 2016] [mpm_winnt:notice] [pid 9604:tid 520] AH00456: Apache Lounge VC11 Server built: Oct 13 2015 10:54:13
[Fri Aug 12 15:32:44.505654 2016] [core:notice] [pid 9604:tid 520] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Aug 12 15:32:44.506656 2016] [mpm_winnt:notice] [pid 9604:tid 520] AH00418: Parent: Created child process 760
[Fri Aug 12 15:32:44.828542 2016] [ssl:warn] [pid 760:tid 636] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 12 15:32:44.923796 2016] [ssl:warn] [pid 760:tid 636] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Aug 12 15:32:44.953876 2016] [mpm_winnt:notice] [pid 760:tid 636] AH00354: Child: Starting 150 worker threads.
[Fri Aug 12 15:33:14.458548 2016] [autoindex:error] [pid 760:tid 1880] [client 127.0.0.1:50049] AH01276: Cannot serve directory C:/xampp/htdocs2/blume/: No matching DirectoryIndex (index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,default.php,default.pl,default.cgi,default.asp,default.shtml,default.html,default.htm,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm) found, and server-generated directory index forbidden by Options directive
[Fri Aug 12 15:33:21.897716 2016] [autoindex:error] [pid 760:tid 1884] [client 127.0.0.1:50069] AH01276: Cannot serve directory C:/xampp/htdocs2/blume/: No matching DirectoryIndex (index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,default.php,default.pl,default.cgi,default.asp,default.shtml,default.html,default.htm,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm) found, and server-generated directory index forbidden by Options directive


und das access.log:
Code: Select all
127.0.0.1 - - [12/Aug/2016:15:33:14 +0200] "GET /blume HTTP/1.1" 301 331 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0"
127.0.0.1 - - [12/Aug/2016:15:33:14 +0200] "GET /blume/ HTTP/1.1" 403 1145 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0"
127.0.0.1 - - [12/Aug/2016:15:33:18 +0200] "GET /favicon.ico HTTP/1.1" 404 1180 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0"
127.0.0.1 - - [12/Aug/2016:15:33:21 +0200] "GET /blume HTTP/1.1" 301 331 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0"
127.0.0.1 - - [12/Aug/2016:15:33:21 +0200] "GET /blume/ HTTP/1.1" 403 1145 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0"
priga
 
Posts: 6
Joined: 11. August 2016 17:41
XAMPP version: 5.6.23
Operating System: Windows 10

Re: 2. virtueller Server funktioniert nicht

Postby Altrea » 12. August 2016 15:39

Cannot serve directory C:/xampp/htdocs2/blume/: No matching DirectoryIndex (index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,default.php,default.pl,default.cgi,default.asp,default.shtml,default.html,default.htm,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm) found, and server-generated directory index forbidden by Options directive

Die Fehlermeldung ist doch mehr als sprechend...
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: 2. virtueller Server funktioniert nicht

Postby Nobbie » 12. August 2016 18:34

Altrea wrote:Die Fehlermeldung ist doch mehr als sprechend...


Wenn man sie liest...
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to XAMPP für Windows

Who is online

Users browsing this forum: No registered users and 34 guests