The Apache service named reported the following error:


在系統啟動時apache,沒有啟動起來,查看“事件查看器”發現報一些錯誤:

The Apache service named  reported the following error:
>>> httpd.exe: Could not reliably determine the server’s fully qualified domain name, using 192.168.0.200 for ServerName

回頭,查看apache日志logs/error.log,發現報的是類似的錯誤。

都是說Could not reliably determine the server’s fully qualified domain name。

我先分析了下,似乎是apache啟動時可能會查詢DNS來驗證ServerName的配置。可是我用的是私有IP的,這怎么配置?

抱着疑問的態度,我又查看 httpd.conf 文件,查找關於ServerName配置的片段,我忽然發現,人家已經在注釋中把這個問題說的很詳細,可是我在開始的配置中卻忽視了他。

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn’t have a registered DNS name, enter its IP address here.
#
#ServerNamewww.web8cn.com:80

所以嘛,你如果是在本地電腦上開發,可以這樣寫:

ServerName 127.0.0.1:80

重新啟動apache查看日志無再報錯,問題解決了。

這是我又回過頭好好想想我安裝apache時的步驟。

我發現開始安裝的時候,如果它會讓你填寫類似 域名和主機名的信息。

如果你是正式部署可以寫正確的域名,如果只是開發用的是私有IP的話可以寫自己的私有IP。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM