如何设置服务器的完全限定域名?

rea*_*der 7 apache configuration fqdn

当我尝试重新启动apache发布/etc/init.d/apache2 restart时,我收到以下消息:

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:~#
Run Code Online (Sandbox Code Playgroud)

注意:/ etc/hosts中ip末尾的两个星号是在发布时添加的.注2:假设我的域名是www.xyz.net

我想知道我必须一步一步地做些什么.非常感谢!

小智 21

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

sudo gedit /etc/apache2/httpd.conf
Run Code Online (Sandbox Code Playgroud)

添加行:

ServerName localhost
Run Code Online (Sandbox Code Playgroud)

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

sudo /etc/init.d/apache2 restart
Run Code Online (Sandbox Code Playgroud)

这将照顾它.