2012-02-25 99 views
7

當我嘗試重新啓動Apache issueing /etc/init.d/apache2重新啓動,我得到了以下信息:如何設置服務器的完全限定域名?

[email protected]:~# /etc/init.d/apache2 restart 
* Restarting web server apache2                                apache2: apr_sockaddr_info_get() failed for server 
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName 
... waiting apache2: apr_sockaddr_info_get() failed for server 
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName 
                                         [ OK ] 
[email protected]:~# cat /etc/hostname 
iSell 
[email protected]:~# hostname 
server 
[email protected]:~# hostname -f 
hostname: Name or service not known 
[email protected]:~# cat /etc/hosts 
127.0.0.1  localhost localhost.localdomain 
108.1.*.*  eins 
[email protected]:~# 

注:這兩個星號的IP在/ etc年底/主機是由我添加在發佈時。 注2:假設我的域名是www.xyz.net

我想確切地知道我必須一步一步來做。 非常感謝!

+3

這不是編程相關的。請考慮在其他SE網站上發帖。 – jurgemaister 2012-05-21 07:46:31

+0

此行爲僅在ubuntu – 2012-08-30 14:17:09

回答

21

只要編輯空白httpd.conf中的Apache下列要求:

sudo gedit /etc/apache2/httpd.conf 

添加一行:

ServerName localhost 

保存並退出並重新啓動Apache:

sudo /etc/init.d/apache2 restart 

那將照顧它。

+0

爲我工作謝謝 – 2014-06-30 10:33:46

+0

感謝您也爲我工作! – 2015-10-26 18:17:17

+0

關於Jessie修復/etc/apache2/apache2.conf – fcm 2016-04-27 02:21:34

0

編輯您的hosts文件

sudo nano /etc/hosts 

看,如果你的ip 127.0.1.1作爲服務器

127.0.1.1  srv-web-01 

,並重新啓動的好名字你的Apache

sudo service apache2 restart 
+0

apache2不夠 – fcm 2016-04-27 02:20:17

1

1)編輯文件: vi /etc/apache2/apache.conf 2)寫在最後一行(t o看你的機器名寫:cat/etc/hostname): ServerName你的機器名稱 3)service apache2 reload

enjoyit!

1
  1. 首先,檢查你的Apache的版本
    $ apache2 -v
  2. 如果你的Apache版本2.x中,使用下面的命令來避免此消息
    $ echo "ServerName\t`cat /etc/hostname`" | sudo tee -a /etc/apache2/apache2.conf
1

的服務器名稱添加到/etc/apache2/apache.conf

ServerName [yourservername or localhost] 

and lo ad Apache配置: service apache2 restart

相關問題