2013-08-17 62 views
8

我知道這個問題已經被看了很多,但這裏的解決方案並沒有解決它們。httpd:無法可靠地確定服務器的完全合格的域名

讓我們先了解一下背景資料:

OS X 10.8.4 的Apache 2.2.22

問題: 我在控制檯收到此錯誤和Apache無法找到我的本地,但確實開始。奇怪的。

[Sat Aug 17 13:40:06 2013] [info] mod_ssl/2.2.22 compiled against Server: Apache/2.2.22, Library: OpenSSL/0.9.8r 
httpd: Could not reliably determine the server's fully qualified domain name, using Specter.local for ServerName 

所以通常這會指向我的ServerName沒有被設置正確。那麼它是:/我已經嘗試過不同的變種,如Specter.local,localhost等

這是我的/private/etc/httpd.conf的副本&這與/ private/etc/apache2 /httpd.conf

# 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. 
# 
ServerName localhost 

我的主機文件的設置如下:

127.0.0.1 localhost localhost.local 
255.255.255.255 broadcasthost 
127.0.0.1  themill.dev 
127.0.0.1  phpmyadmin.dev 
127.0.0.1  Specter.local 

在我/private/etc/apache2/users/ta.conf如下

# 
# Use name-based virtual hosting. 
# 
NameVirtualHost *:80 
# DEV: THEMILL SITE 
<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "/Users/ta/Sites/themill/htdocs" 
    ServerName themill.dev 
    ServerAlias *.themill.dev 
    ErrorLog "/Users/ta/Sites/themill/log/error_log" 
    CustomLog "/Users/ta/Sites/themill/log/access_log" common 
</VirtualHost> 

# PHPMYADMIN 
<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "/Users/ta/Sites/phpmyadmin" 
    ServerName phpmyadmin.dev 
    ServerAlias *.phpmyadmin.dev 
    ErrorLog "/Users/ta/Sites/phpmyadmin/log/error_log" 
    CustomLog "/Users/ta/Sites/phpmyadmin/log/access_log" common 
</VirtualHost> 

不知道還有什麼應該配置真的。它曾經工作,但發佈10.7升級,它從來沒有工作,現在,我正在試圖解決它它正在做我的頭。

讓我知道如果你需要更多的信息。

+1

發出該消息的代碼僅在全局配置沒有servername時運行,您確定這些配置文件正在使用嗎? – covener

回答

8

忽略關於設置ServerNames的所有建議。恕我直言,這是一個紅鯡魚。 Apache正在嘗試使用標準系統組件來確定FQDN並找不到合適的東西。當然,你可以通過向Apache全局添加一個指令來顛覆這個過程,但認爲這是治療症狀。當然,你的應該在虛擬主機塊中有ServerName指令。

相反,編輯您的主機文件,並確保您有一個FQDN在那裏列出。我看到的語法各種建議,爲特定的127 *線,但我認爲這並不重要的東西是什麼順序,只要有一個FQDN上市:

127.0.0.1  localhost.localdomain localhost  foo.example.com 

這爲我工作並且看起來比其他所有人都「爲我工作!」 upvotes推薦你編輯httpd.conf等。我希望這會有所幫助,我不會陷入低谷。如果您不同意,請舉例說明爲什麼。謝謝。

http://wiki.apache.org/httpd/CouldNotDetermineServerName

一旦Apache可以決定系統的FQDN,它就會讀取您的特定服務器名稱的指示爲您NameBasedHosts。

+3

「確保你有一個FQDN在那裏列出」 - 我已經在這個問題的許多答案中看到了這一點。通過完全合格的域名,你的意思是我實際上可以使用foo.example.com或域名是否必須是* actual *域名?我從來不明白foo.example.com是否意味着'您的實際購買和擁有的域名',或者'特別'在此處放置任何遵循FQDN模式的域名,即www.mynonexistentdomain.com'。有人能提供清晰度嗎? – Wittner

1

httpd.conf文件中的以下行是正確的:

ServerName localhost 

的問題是, macOS這是錯誤的文件(不是/private/etc/httpd.conf)。

要找到您httpd.conf Apache配置文件的正確的位置,運行:

apachectl -t -D DUMP_INCLUDES 

然後仔細檢查是否ServerName是取消註釋並設置爲localhost

相關問題