亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

虛擬主機無法在 XAMPP 上運行,發生了一些非常奇怪的事情

虛擬主機無法在 XAMPP 上運行,發生了一些非常奇怪的事情

PHP
LEATH 2023-04-21 10:17:32
您好我已經瀏覽了所有資源,但似乎仍然找不到解決方案。我的計算機上安裝了 XAMPP Control Panel v 3.2.4(2019 年 6 月 5 日編譯),它安裝在 d:\xampp 中。我想創建一個虛擬主機,以便我可以正確使用各種全局 PATH 變量。我嚴格按照說明進行操作。這是來自我的 D:\xampp\apache\conf\extra\httpd-vhosts.conf:    <VirtualHost *:80>     ServerName localhost     DocumentRoot "D:\xampp\htdocs"     <Directory "D:\xampp\htdocs">         DirectoryIndex index.php     </Directory> </VirtualHost><VirtualHost *:80>     ServerName ikeen.localhost     DocumentRoot "D:\xampp\htdocs\ikeen"     SetEnv APPLICATION_ENV "development"     <Directory "D:\xampp\htdocs\ikeen">         DirectoryIndex index.php         AllowOverride All         Order allow,deny         Allow from all             </Directory> </VirtualHost>我在 httpd.conf 的末尾添加了以下幾行:<Directory />    AllowOverride none    Require all granted</Directory>我在 Windows 的主機文件中有以下行:127.0.0.1      ikeen.localhost這是我的站點目錄的結構為了避免緩存,我以隱身模式和不同的瀏覽器打開 URL。我總是重定向到儀表板 - https://ikeen.localhost/dashboard/,它打開標準的“歡迎使用 Windows 7.4.3 XAMPP”聽說跟https有關系,我用http也總是轉到https url。我查看了 httpd-ssl.conf,但我不知道在那里做什么。有任何想法嗎?
查看完整描述

3 回答

?
茅侃侃

TA貢獻1842條經驗 獲得超21個贊

最后!對于正在尋找解決方案的每個人,請執行以下操作:


我想要的站點位于 D:\xampp\htdocs\ikeen。


1) 將此添加到您的 httpd-vhosts.conf:


<VirtualHost *:80>

     ServerName localhost

     DocumentRoot "D:\xampp\htdocs"

     <Directory "D:\xampp\htdocs">

         DirectoryIndex index.php

     </Directory>

 </VirtualHost>


<VirtualHost *:80>

     ServerName ikeen.localhost

     DocumentRoot "D:\xampp\htdocs\ikeen"

     SetEnv APPLICATION_ENV "development"

     <Directory "D:\xampp\htdocs\ikeen">

         DirectoryIndex index.php

         AllowOverride All

         Order allow,deny

         Allow from all        

     </Directory>

 </VirtualHost>

2) 將此添加到 httpd.conf 的末尾:


<Directory />

    AllowOverride none

    Require all granted

</Directory>

3) 將此行添加到 Windows 目錄中的主機文件


127.0.0.1      ikeen.localhost

4) 最后,這是所有解決方案中都缺少的步驟。將此添加到您的 httpd-ssl.conf,在您的本地主機(通常是 www.example.com)的相同部分之后,將 example.com 更改為本地主機的本地設置,以便整個部分看起來像這樣


<VirtualHost _default_:443>


#   General setup for the virtual host

DocumentRoot "D:/xampp/htdocs"

#ServerName www.example.com:443

ServerName localhost

ServerAdmin [email protected]

ErrorLog "D:/xampp/apache/logs/error.log"

TransferLog "D:/xampp/apache/logs/access.log"


#   General setup for the ikeen host

DocumentRoot "D:/xampp/htdocs/ikeen"

#ServerName www.example.com:443

ServerName ikeen.localhost

ServerAdmin [email protected]

ErrorLog "D:/xampp/apache/logs/error.log"

TransferLog "D:/xampp/apache/logs/access.log"


查看完整回答
反對 回復 2023-04-21
?
蕪湖不蕪

TA貢獻1796條經驗 獲得超7個贊

我遇到過同樣的問題。通過刪除標準虛擬主機條目解決了問題,我沒有被重定向到根目錄。


只需刪除這些代碼行:


<VirtualHost *:80>

     ServerName localhost

     DocumentRoot "D:\xampp\htdocs"

     <Directory "D:\xampp\htdocs">

         DirectoryIndex index.php

     </Directory>

 </VirtualHost>


查看完整回答
反對 回復 2023-04-21
?
Cats萌萌

TA貢獻1805條經驗 獲得超9個贊

如果這種情況不起作用,也許更改 httpd-ssl.conf


我的 3 個網站有效,localhost、test1.com、test2.com


#

<VirtualHost _default_:443>

DocumentRoot "c:/xampp/htdocs"

ServerName localhost

ServerAdmin [email protected]

ErrorLog "c:/xampp/apache/logs/error.log"

TransferLog "c:/xampp/apache/logs/access.log"


...

</VirtualHost>


#test1

<VirtualHost _default_:443>

DocumentRoot "c:/xampp/htdocs/test1"

ServerName test1.com

ServerAdmin [email protected]

ErrorLog "c:/xampp/apache/logs/error.log"

TransferLog "c:/xampp/apache/logs/access.log"


...

</VirtualHost>


#test2

<VirtualHost _default_:443>

DocumentRoot "c:/xampp/htdocs/test2"

ServerName test1.com

ServerAdmin [email protected]

ErrorLog "c:/xampp/apache/logs/error.log"

TransferLog "c:/xampp/apache/logs/access.log"


...

</VirtualHost>   


查看完整回答
反對 回復 2023-04-21
  • 3 回答
  • 0 關注
  • 172 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號