2017-04-19 96 views
0

我使用Apache2作爲本地Piwik服務器進行測試,今天早上它突然停止工作。當我嘗試訪問http://127.0.1.1/piwik/index.php時,我得到的是一個404,表示無法找到請求的URL。實際上,我甚至無法生成標準的index.html,只有「It Worked」默認頁面。Apache2無法訪問任何內容

我的文件都在var/www/html,這是我的000-default.conf的樣子:

<VirtualHost *:80> 
    #ServerName www.example.com 

    ServerAdmin [email protected] 
    DocumentRoot /var/www/html 

    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 

</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

正如你所看到的,我並沒有改變的事情,直到今天上午Piwik服務器工作完美。

任何幫助將不勝感激,但請注意,我是Linux和Apache的新手,所以請在回答時考慮這一點。

+0

你能告訴'apache2ctl -S'的輸出?你也試過重啓apache服務'sudo service apache2 restart'。你還可以顯示位於'/ var/www/html'文件夾下的任何'.htaccess'文件的內容嗎? – Cyclonecode

+0

很確定這是'.htaccess'或可能缺少'/ var/www/html'文件夾的'Allowoverride'指令的問題。 – Cyclonecode

+0

@Cyclonecode [這是我的輸出到apache2ctl -S](http://imgur.com/RgZ7DEb) 我實際上完全重新安裝了Apache,我似乎在我的文件夾中沒有任何'.htaccess'文件。 –

回答

0

試試這個

<VirtualHost *:80> 
    #ServerName www.example.com 

    ServerAdmin [email protected] 
    DocumentRoot /var/www/html 

    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined 

    <Directory /var/www/html/> 
     DirectoryIndex index.html 
     AllowOverride All 
     Require all granted 
    </Directory> 
</VirtualHost> 

也許你丟失的目錄部分訪問文件