8

When i try to restart apache issueing /etc/init.d/apache2 restart i get the following messages:

root@server:~# /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 ]
root@server:~# cat /etc/hostname
iSell
root@server:~# hostname
server
root@server:~# hostname -f
hostname: Name or service not known
root@server:~# cat /etc/hosts
127.0.0.1     localhost localhost.localdomain
108.1.*.*     eins
root@server:~#

Note:the two asterisk at the end of ip in /etc/hosts are added by me at the time of posting. Note2: let's say my domain name is www.xyz.net

I would like to know exactly what i must do step by step please. Thank's very much!

4

5 回答 5

22

只需使用以下内容编辑 Apache 的空白 httpd.conf:

sudo gedit /etc/apache2/httpd.conf

添加行:

ServerName localhost

保存并退出并重新启动 Apache:

sudo /etc/init.d/apache2 restart

那会照顾它的。

于 2012-05-20T07:50:21.597 回答
2
  1. 首先,检查你的 apache 版本
    $ apache2 -v
  2. 如果您的 apache 版本是 2.x,请使用以下命令来避免此消息
    $ echo "ServerName\t`cat /etc/hostname`" | sudo tee -a /etc/apache2/apache2.conf
于 2014-10-23T08:38:03.693 回答
2

1) 编辑文件:vi /etc/apache2/apache.conf 2) 在最后一行写入(查看 your-machine-name 写入:cat /etc/hostname):ServerName your-machine-name 3)service apache2 reload

好好享受!

于 2014-10-14T13:37:49.190 回答
2

编辑你的主机文件

sudo nano /etc/hosts

看看你是否将 ip 127.0.1.1 作为服务器的好名字

127.0.1.1      srv-web-01

并重新启动您的 Apache

sudo service apache2 restart
于 2014-02-27T15:51:56.270 回答
2

将 ServerName 添加到 /etc/apache2/apache.conf

ServerName [yourservername or localhost]

并加载 Apache 配置: service apache2 restart

于 2016-06-27T09:03:55.290 回答