Apache cannot start httpd: apr_sockaddr_info_get () failed xgp

Source: Internet
Author: User
Tags fully qualified domain name

Apache cannot start httpd: apr_sockaddr_info_get () failed xgp

Httpd: apr_sockaddr_info_get () failed for hoteel
Httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
I am prompted for the above information during service httpd restart. Although the startup is successful, it is also very depressing.
This is caused by hostname hoteel when I configure DNS.
Run the hostname localhost command again.
I found some information about this on the internet and posted it here by the way.
1
When httpd is started
Starting httpd: apr_sockaddr_info_get () failed for MYHOST
Httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName.
This problem is not found in/etc/httpd/conf/httpd. set ServerName in conf, so it will be replaced by the name on the host. First, you will find the definition of the host in/etc/hosts.
To solve this problem, set ServerName or enter your host name MYHOST in/etc/hosts, as shown in the following code:
> Vi/etc/hosts
127.0.0.1 localhost. localdomain localhost MYHOST

2
After Apache 2.2.6 is installed in Linux, an error is reported when the HTTP service is started. It does not seem to affect the service usage, but it is also awkward.

[Root @ linux http] #./apachectl start
Httpd: apr_sockaddr_info_get () failed for linux (apr_sockaddr_info_get () failed for freebsdla on BSD)
Httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

It is found that the configuration file httpd is under the conf directory of apache. if the hostname settings in conf and the HOSTNAME settings in/etc/sysconfig/network are inconsistent, you can change them to a uniform host name to solve the problem.

Note: The default Host Name of/etc/sysconfig/network is: HOSTNAME = localhost. localdomain

PS: It seems useless to use this method on the Internet, because I think apache will Compile ARP during the compilation and installation process, so the following operations are a bit redundant.

Apr and apr-util are included in the Apache httpd release source code and will not be used in most cases. Of course, if apr or apr-util version 1.0 or 1.1 is already installed in your system, you must upgrade your apr/apr-util to version 1.2, or compile httpd separately. You must manually install the source code apr/apr-util in the source code of the release:

# Compile and install apr 1.2

Apr
./Configure -- prefix =/x/httpd/apr
Make
Make install

Apr-util
./Configure -- prefix =/x/httpd/apr_util -- with-apr =/x/httpd/apr
Make
Make install

Apache
./Configure -- prefix =/x/httpd/apache2 \
-- Enable-so \
-- Enable-cgi \
-- Enable-rewrite \
-- Enable-mod-shared = all \
-- With-apr =/x/httpd/apr \
-- With-apr-util =/x/httpd/apr_util

LDFLAGS = "-L/usr/lib64-L/lib64"

The correct settings of the local machine must be the same

[Root @ bkjia ~] # Nl/etc/hosts
1 # Do not remove the following line, or various programs
2 # that require network functionality will fail.
3 127.0.0.1 localhost. localdomain bkjia

[Root @ spring ~] # Nl/etc/sysconfig/network
1 NETWORKING = yes
2 NETWORKING_IPV6 = no
3 HOSTNAME = bkjia
4 # GATEWAY = 192.168.8.1

[Root @ bkjia ~] # Less/etc/httpd/conf/httpd. conf | grep ServerName
# ServerName gives the name and port that the server uses to identify itself.
# ServerName www.example.com: 80
ServerName 127.0.0.1

CentOS 6.5 compile and install httpd-2.4.7

Comparison of working models in httpd

Source code compilation and installation of httpd2.4 and virtual host

Compile and install the latest httpd-2.4

Implementation of httpd2.4 basic functions...

Basic tutorial on Apache Httpd server

This article permanently updates the link address:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.