2016-06-12 16 views
0

ローカルWindowsマシン上でxamppに3つのvhosts設定があります。Apacheは他の仮想ホストのルートフォルダではなく、1つの仮想ホストにデフォルト設定します

私がブラウザをstage.localまたはhost.localに向けると、最初に設定した仮想ホストであるdev.localにリダイレクトされますが、デフォルトの仮想ホストではありません。

しかし、私がhost.local/index.phpに行くと、壊れたファイルが表示されます。何とかそれはちょうど台無しにされているルートディレクトリです。 これがどのように可能か、これを修正する方法がわかりません。

設定が正しいようだ、ここで完全なファイルは次のとおりです。

と私のhostsファイル

*:*     is a NameVirtualHost 
    default server host.local (C:/xampp/apache/conf/extra/httpd-vhosts.conf:29) 
    port * namevhost host.local (C:/xampp/apache/conf/extra/httpd-vhosts.conf:29) 
    port * namevhost stage.local (C:/xampp/apache/conf/extra/httpd-vhosts.conf:35) 
    port * namevhost dev.local (C:/xampp/apache/conf/extra/httpd-vhosts.conf:43) 

(一部のSSLものの後):

# 
# Use name-based virtual hosting. 
# 
NameVirtualHost * 
# 
# 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 *> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/host.local/" 
    ServerName host.local 
</VirtualHost> 

<VirtualHost *> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/stage.local/" 
    ServerName stage.local 
    ErrorLog "logs/stage.local-error.log" 
    CustomLog "logs/stage.local-access.log" common 
</VirtualHost> 

<VirtualHost *> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/dev.local/" 
    ServerName dev.local 
    ErrorLog "logs/dev.local-error.log" 
    CustomLog "logs/dev.local-access.log" common 
</VirtualHost> 

とのhttpd -Sこの言います次のエントリがあります。

127.0.0.1 localhost 
127.0.0.1 host.local 
127.0.0.1 stage.local 
127.0.0.1 dev.local 

答えて

0

私のために働いています。たとえば、次のようにポートを定義する必要があります。 -

# 
# 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 [email protected] 
    DocumentRoot "C:/xampp/htdocs/host.local/" 
    ServerName host.local 
</VirtualHost> 

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/stage.local/" 
    ServerName stage.local 
    ErrorLog "logs/stage.local-error.log" 
    CustomLog "logs/stage.local-access.log" common 
</VirtualHost> 

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs/dev.local/" 
    ServerName dev.local 
    ErrorLog "logs/dev.local-error.log" 
    CustomLog "logs/dev.local-access.log" common 
</VirtualHost> 
関連する問題