2013-10-03 22 views
0

我的服務器上有「Apache 2.4.6(Ubuntu)」和「PHP 5.5.4-1(cli)」,我建立了一個工作正常的子域,運行PHP腳本,但沒有任何圖像顯示出來。我已經將圖像的URL輸入到網絡瀏覽器中,並且只是在那裏加載了很長時間。Apache沒有提供子域映像

我一直在玩我的網站可用的配置文件,但似乎無法讓他們顯示。我沒有.htaccess文件阻止圖像或類似的東西。

這是我subdomain.domain.com.conf文件(編輯不給出任何細節):

# domain: subdomain.domain.com 
# public: /home/username/public/domain.com/subdomain/public 

<VirtualHost subdomain.domain.com:80> 
    <Directory /> 
    Options FollowSymLinks 
    AllowOverride None 
    </Directory> 

    <Directory "/home/username/public/domain.com/subdomain/public"> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Require all granted 
    </Directory> 

    # Admin email, Server Name (domain name), and any aliases 
    ServerAdmin [email protected] 
    ServerName www.subdomain.domain.com 
    ServerAlias subdomain.domain.com 

    # Index file and Document Root (where the public files are located) 
    DirectoryIndex index.html index.php 
    DocumentRoot /home/username/public/domain.com/subdomain/public 

    # Log file locations 
    LogLevel warn 
    ErrorLog /home/username/public/domain.com/log/error.log 
    CustomLog /home/username/public/domain.com/log/access.log combined 
</VirtualHost> 

當我嘗試查看: subdomain.domain.com/elements/img/test png格式

瀏覽器只是坐在自己載入中...

我是不是在尋找解決這個問題的正確的地方?我應該檢查其他配置文件嗎?不知怎的,我的domain.com.conf文件是否與子域混淆?

謝謝,我感謝你的幫助!

+0

什麼是apache的訪問日誌和錯誤日誌? – JorgeeFG

+0

訪問日誌有1行 119.63.196.28 - [02/Oct/2013:06:12:56 +0000]「GET /images/mini.png HTTP/1.1」404 473「 - 」「Baiduspider-image +(+ http://www.baidu.com/search/spider.htm)「 這是不是我想要訪問的圖像和錯誤日誌有: [Thu Oct 03 13:02:44.627024 2013] [mpm_prefork :通知] [pid 24839] AH00169:發現SIGTERM,關閉 [Thu Oct 03 13:02:45.838208 2013] [mpm_prefork:notice] [pid 24955] AH00163:Apache/2.4.6(Ubuntu)PHP/5.5.4 -1 + debphp.org〜精確+ 1配置 - 恢復正常操作 這是我在做Apache重啓我相信... –

+0

好吧,我剛剛輸入了一個圖像的URL在主域圖像文件夾中,顯示出來了,我把這個子域前綴加到了URL的思想中在那裏會給我一個404,但它爲我提供了坐在我的主域名上的圖像?!這是怎麼發生的? –

回答

0

我認爲你的問題是你不使用基於名字的虛擬主機。除非你爲每個主機有一個單獨的IP?

試着改變你的虛擬主機:

<VirtualHost *:80>

您可能需要更改您的主要宿主,以及但是這一切都在這裏Apache docs解釋。

希望它能幫助你前進。

+0

更改所有我的.conf文件有,但仍然是相同的...我應該把我的主域.conf文件在原始文章?這可以影響它嗎? –

+0

做了一個ctrl + F5和圖像回來了!我假設這是虛擬主機的一部分,做了詭計?我可能會改回它,看看會發生什麼。 –

+0

如果您沒有正確的虛擬主機設置,則名爲vs基於apache的用戶將無法區分它們,並最終進入所有請求的默認站點。玩弄它並不是一個壞主意,理解這一切。祝你好運。 :-) – Qben