2017-05-24 21 views
0

ゴール: - 仮想ホストを正しく設定します。仮想ホストにディレクトリ構造が表示されます

現在、私はMACシステムのバージョン10.10.05 os x yosemiteに取り組んでいます。

私は、仮想ホストを設定するためのall the necessary stepsに従っていXAMPP

使用apache2の、PHPとMySQLを設定しています。 /private/etc/apache2/extra/httpd-vhosts.conf

私のファイルだから

<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> 

ようになり、今私はhttp://emsv2l.localhost.com/を書く場合は代わりに、それはディレクトリ構造を示すのプロジェクトにリダイレクトされます。

enter image description here

/etc/hostsファイルには、任意の助けをいただければ幸いです

## 
# 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 

ようなものです。

+0

を求めた場合は、apacheのサービスへのアクセスを持っていますか? Apacheを再起動する必要があるかもしれません。 – ImAtWar

+0

多くの時間私はXAMPP GUIを使用してApacheを再起動している。 –

+0

@ShashankShahあなたのファイルを '/ Applications/XAMPP/xamppfiles/htdocs/emsv2'に表示することができます。 – lloiacono

答えて

2

は、あなたはそれがこれを置き換える行うには、ディレクトリのリストを無効にする必要があります。

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

で:

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

その後リロードapacheの。詳細については

は、あなたの内のindex.phpやindex.htmlをを持っています、そして、もう一つのことを

hereを確認してください。/Applications/XAMPP/xamppfiles/htdocs/emsv2

+0

インデックスをオフにする必要はありません。それは実際にあなたが使いたいものかもしれません。しかし、確かにインデックスを確認してください。* file – G4Hu

+0

私は上記を試しましたが、ファイルの内容が変更されていないため、Apacheを再起動します。 –

1

迷惑メールを手紙に設定するためのガイドに従っていますか? もしそうなら、設定したApacheが現在ポート80でリッスンしているものであることを確認してください。 XAMPPには独自のApacheが組み込まれている必要があります。デフォルトの設定では動作しません。 あなたのXAMPPのhttpd.confに含まれている必要があります

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

をちょうど最速を解決するために:

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

を 'Y' 上書き確認プレス

関連する問題