如何在FreeBSD上configuration`apache22`包的主机名?

我正在VM上configuration开发和testingFreeBSD机器。 我安装了apache22软件包并重新启动。 但守护进程不会以这个错误开始:

 %apachectl start httpd: apr_sockaddr_info_get() failed for test.box httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName (13)Permission denied: make_sock: could not bind to address [::]:80 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs % 

我的主机名test.box 。 因为这是暂时的testing框,所以没有真正的域名。 但是我使用了2级名称来避免在启动时长时间等待sshd

但是,我search了网页,并修改了/etc/hosts文件(我以前没有碰过这个文件):

 # This is original configuration #::1 localhost localhost.my.domain #127.0.0.1 localhost localhost.my.domain # New configuration ::1 localhost test.box 127.0.0.1 localhost test.box 127.0.0.1 test.box test 

现在apache失败并显示以下错误消息:

 %apachectl start httpd: Could not reliably determine the server's fully qualified domain name, using test.box for ServerName (13)Permission denied: make_sock: could not bind to address [::]:80 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs % 

我不知道现在需要什么。 请让我知道这个错误的原因和解决scheme。

—-(编辑)—-

许可错误是由于sudo遗漏导致的。

 httpd: Could not reliably determine the server's fully qualified domain name, using test.box for ServerName 

通常,这只是一个警告,而不是一个致命的错误。 这可以通过将configuration添加到您的apache2.conf文件来解决。

 ServerName yourserver.yourdomain.com 

我可以看到有一个权限被拒绝的错误。 确保以超级用户root身份调用启动脚本。 另外,确保没有其他进程正在监听apache端口(默认为80)。

我find了一个解决scheme。 / etc / hosts文件configuration不好。 这是正确的configuration。

 # This is original configuration #::1 localhost localhost.my.domain #127.0.0.1 localhost localhost.my.domain ::1 localhost.test.box localhost 127.0.0.1 localhost.test.box localhost 127.0.0.1 test.box test