2017-05-24 4 views
0

Ziel: - richten Sie den virtuellen Host richtig ein.Virtueller Host zeigt Verzeichnisstruktur

zur Zeit arbeite ich auf MAC-System Version 10.10.05 os x yosemite.

Ich habe konfiguriert apache2, PHP und MySQL mit XAMPP

I all the necessary steps für die Konfiguration von virtuellen Host folgen.

meine Datei /private/etc/apache2/extra/httpd-vhosts.conf wäre wie

<VirtualHost *:80> 
    ServerName localhost 
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" 
    <Directory "/Applications/XAMPP/xamppfiles/htdocs"> 
     Options Indexes FollowSymLinks Includes execCGI 
     AllowOverride All 
     Require all granted 
    </Directory> 
</VirtualHost> 

<VirtualHost *:80> 
    ServerName emsv2l.localhost.com 
    ServerAlias emsv2l.localhost.com 
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/emsv2" 
    ErrorLog "/private/var/log/apache2/apple.com-error_log" 
    CustomLog "/private/var/log/apache2/apple.com-access_log" common 
    ServerAdmin [email protected] 
     <Directory "/Applications/XAMPP/xamppfiles/htdocs/emsv2"> 
       Options Indexes FollowSymLinks Includes ExecCGI 
       AllowOverride All 
       Require all granted 
     </Directory> 
</VirtualHost> 

<VirtualHost *:80> 
    ServerName emsv2l-backend.plutustec.com 
    ServerAlias emsv2l-backend.plutustec.com 
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/emsv2-backend/public“ 
    ErrorLog "/private/var/log/apache2/apple.com-error_log" 
    CustomLog "/private/var/log/apache2/apple.com-access_log" common 
    ServerAdmin [email protected] 
     <Directory "/Applications/XAMPP/xamppfiles/htdocs/emsv2-backend/public“> 
       Options Indexes FollowSymLinks Includes ExecCGI 
       AllowOverride All 
       Require all granted 
     </Directory> 
</VirtualHost> 

Also, wenn ich nun http://emsv2l.localhost.com/ zu projizieren würde schreiben umleiten anstatt Verzeichnisstruktur es zeigt.

enter image description here

meine /etc/hosts Datei wäre wie

## 
# Host Database 
# 
# localhost is used to configure the loopback interface 
# when the system is booting. Do not change this entry. 
## 
#127.0.0.1  localhost 
#255.255.255.255  broadcasthost 
#::1    localhost 
#127.0.0.1  dev.local 
#127.0.0.1  emsv2l-backend.plutustec.com    # emsv2-backend 
#127.0.0.1  emsv2l.plutustec.com    # emsv2 
#127.0.0.1  plutustec.com #localplutus site 
127.0.0.1 emsv2l.localhost.com 
127.0.0.1 emsv2l-backend.plutustec.com 

Jede Hilfe würde geschätzt.

+0

tun Sie Zugriff auf Apache-Service haben? Möglicherweise müssen Sie Apache neu starten. – ImAtWar

+0

viele Zeit habe ich Apache neu starten mit XAMPP GUI. –

+0

@ShashankShah können Sie uns Ihre Dateien unter '/ Anwendungen/XAMPP/xamppfiles/htdocs/emsv2 'zeigen gibt es einen Index. * Datei dort? – lloiacono

Antwort

2

Sie müssen Verzeichnisliste deaktivieren, zu, dass dies zu tun ersetzen:

<Directory "/Applications/XAMPP/xamppfiles/htdocs/emsv2"> 
     Options Indexes FollowSymLinks Includes ExecCGI 
     AllowOverride All 
     Require all granted 
</Directory> 

mit:

<Directory "/Applications/XAMPP/xamppfiles/htdocs/emsv2"> 
     Options FollowSymLinks Includes ExecCGI 
     AllowOverride All 
     Require all granted 
</Directory> 

Dann Reload Apache.

Für weitere Informationen überprüfen here

Dann noch eine Sache, haben Sie eine index.php oder index.html in Ihrem: /Applications/XAMPP/xamppfiles/htdocs/emsv2?

+0

Die Indizierung sollte zum Ausschalten nicht erforderlich sein. Es könnte tatsächlich etwas sein, das Sie verwenden möchten. Aber in der Tat nach einem Index suchen.* Datei – G4Hu

+0

Ich habe oben versucht, aber es funktioniert nicht geändert Inhalt der Datei und Apache neu starten. –

1

Haben Sie die Anleitung zum Konfigurieren von vhosts genau befolgt? Wenn ja, sind Sie sicher, dass der von Ihnen konfigurierte Apache derjenige ist, der gerade Port 80 überwacht? XAMPP sollte seinen eigenen eingebauten Apache haben und es läuft nicht von der Standardkonfiguration ab. Ihr sollte XAMPP httpd.conf enthalten:

# XAMPP VirtualHosts dir 
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf 

zu lösen schnellste gerade:

cp -iv /private/etc/apache2/extra/httpd-vhosts.conf /Applications/XAMPP/etc/extra/httpd-vhosts.conf 

Wenn zum Überschreiben Bestätigung drücken Sie 'y' fragte

Verwandte Themen