簡體   English   中英

apache不能正確處理子域虛擬主機窗口

[英]apache not handling subdomains properly virtual hosts windows

我搜索了很多帖子,並嘗試了在httpd.conf中配置它的各種方法。

我在Windows Server 2012上使用PHP 5.6和MySQL運行Apache 2.4。 在亞馬遜EC2實例上。 我具有所有正確的安全設置,並且還在路由S3中正確設置了我的dn,以指向我的EC2,並為我的子域設置了A條目。 主域名www.mydomain.com正常運行,並指向htdocs的正確位置。 但是,我的子域未映射到如下定義的文件夾:

NameVirtualHost ip.ip.ip.ip:80      

<VirtualHost *:80>
    ServerName www.mydomain.com
    ServerAlias mydomain.com
    DocumentRoot c:/Apache24/htdocs
    DirectoryIndex index.php index.htm index.html
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot c:/Apache24/htdocs/sub1
    ServerName sub1.mydomain.com
    DirectoryIndex index.php index.htm index.html
    ErrorLog logs/sub1-error.txt
    CustomLog logs/sub1-access.txt common
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot c:/Apache24/htdocs/phpMyAdmin
    ServerName phpmyadmin.mydomain.com
    DirectoryIndex index.php index.htm index.html
    ErrorLog logs/phpmyadmin-error.txt
    CustomLog logs/phpmyadmin-access.txt common
</VirtualHost>

所有幫助,不勝感激。

我的HOSTS文件中也有這些條目

    ip.ip.ip.ip mydomain.com
ip.ip.ip.ip *.mydomain.com
ip.ip.ip.ip sub1.mydomain.com
ip.ip.ip.ip phpmyadmin.mydomain.com

ip.ip.ip.ip是我的服務器的公用IP地址。

您可以在此處閱讀 Apache 2.4的virtualhosts示例中的“使用ServerPath指令”部分(最后在注釋部分之前)。 我現在沒有嘗試過,但是過去我曾將該頁面用於類似的問題。 由於它是Apache,因此我不會復制任何內容,因為它可能在未來幾年中位於同一地址上...

奇怪的是,我嘗試了@Gillsoft AB的解決方案。 當我嘗試重新啟動apache時,它無法重新啟動。 然后我回到了原來的位置。 然后將每個<VirtualHost *:80>更改為<VirtuHost ip.ip.ip.ip:80> ,然后重新啟動,這是行不通的。 然后我回到最初發布時的狀態,再次重新啟動。 現在可以了嗎????

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM