# Problema al iniciar apache

## maximiliano3

Gente estoy armando un servidorsito con el gentoo instale apache con la manera mas pajuerana 

```
emerge apache
```

me tira error al iniciarlo. Aca un cat de /var/log/apache2/error_log

```
gentoomaxy apache2 # cat error_log 

[Thu Aug 11 10:18:01 2011] [alert] (EAI 3)Temporary failure in name resolution: mod_unique_id: unable to find IPv4 address of "gentoomaxy"

```

 y esto me tira al interntar levantarlo

```

gentoomaxy apache2 # /etc/init.d/apache2 start

 * apache2 has detected an error in your setup:

Usage: /usr/sbin/apache2 [-D name] [-d directory] [-f file]

                         [-C "directive"] [-c "directive"]

                         [-k start|restart|graceful|graceful-stop|stop]

                         [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]

Options:

  -D name            : define a name for use in <IfDefine name> directives

  -d directory       : specify an alternate initial ServerRoot

  -f file            : specify an alternate ServerConfigFile

  -C "directive"     : process directive before reading config files

  -c "directive"     : process directive after reading config files

  -e level           : show startup errors of level (see LogLevel)

  -E file            : log startup errors to file

  -v                 : show version number

  -V                 : show compile settings

  -h                 : list available command line options (this page)

  -l                 : list compiled in modules

  -L                 : list available configuration directives

  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)

  -S                 : a synonym for -t -D DUMP_VHOSTS

  -t -D DUMP_MODULES : show all loaded modules 

  -M                 : a synonym for -t -D DUMP_MODULES

  -t                 : run syntax check for config files

  -T                 : start without DocumentRoot(s) check

 * ERROR: apache2 failed to start

```

y esto cuando lo debuggeo

```

gentoomaxy apache2 # /etc/init.d/apache2 -d  start

+ _conf_d=/etc/init.d/../conf.d

+ _c=apache2

+ '[' -n apache2 -a apache2 '!=' apache2 ']'

+ unset _c

+ sourcex -e /etc/init.d/../conf.d/apache2.default

+ '[' -e = -e ']'

+ shift

+ '[' -e /etc/init.d/../conf.d/apache2.default ']'

+ return 1

+ sourcex -e /etc/init.d/../conf.d/apache2

+ '[' -e = -e ']'

+ shift

+ '[' -e /etc/init.d/../conf.d/apache2 ']'

+ . /etc/init.d/../conf.d/apache2

++ APACHE2_OPTS='-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE USERDIR'

+ unset _conf_d

+ sourcex -e /etc/rc.conf

+ '[' -e = -e ']'

+ shift

+ '[' -e /etc/rc.conf ']'

+ . /etc/rc.conf

++ rc_shell=/sbin/sulogin

++ unicode=YES

++ rc_tty_number=12

+ '[' -n '' ']'

+ sourcex /etc/init.d/apache2

+ '[' /etc/init.d/apache2 = -e ']'

+ . /etc/init.d/apache2

++ opts='configdump configtest fullstatus graceful gracefulstop modules reload virtualhosts'

++ description_configdump='Dumps the configuration of the apache server. Requires lynx and server-info to be enabled.'

++ description_configtest='Run  syntax  tests for configuration files only.'

++ description_fullstatus='Gives the full status of the server. Requires lynx and server-status to be enabled.'

++ description_graceful='A graceful restart advises the children to exit after the current request and reloads the configuration.'

++ description_gracefulstop='A graceful stop advises the children to exit after the current request and stops the server.'

++ description_modules='Dump a list of loaded Static and Shared Modules.'

++ description_reload='Kills all children and reloads the configuration.'

++ description_virtualhosts='Show the settings as parsed from the config file (currently only shows the virtualhost settings).'

++ description_stop='Kills all children and stops the server.'

+ unset _d

+ unset _f

+ '[' -n start ']'

+ '[' start = depend ']'

+ for _cmd in describe start stop status '${extra_commands:-$opts}' '$extra_started_commands'

+ '[' describe = start ']'

+ for _cmd in describe start stop status '${extra_commands:-$opts}' '$extra_started_commands'

+ '[' start = start ']'

++ command -v start

+ '[' start = start ']'

+ yesno

+ '[' -z '' ']'

+ return 1

+ unset _cmd

++ command -v start_pre

+ '[' '' = start_pre ']'

+ start

+ checkconfig

+ checkconfd

+ PIDFILE=/var/run/apache2.pid

+ TIMEOUT=10

+ SERVERROOT=/usr/lib/apache2

+ '[' '!' -d /usr/lib/apache2 ']'

+ CONFIGFILE=/etc/apache2/httpd.conf

+ '[' etc/apache2/httpd.conf = /etc/apache2/httpd.conf ']'

+ '[' '!' -r /etc/apache2/httpd.conf ']'

+ APACHE2_OPTS='-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE USERDIR -d /usr/lib/apache2'

+ APACHE2_OPTS='-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE USERDIR -d /usr/lib/apache2 -f /etc/apache2/httpd.conf'

+ '[' -n '' ']'

+ APACHE2=/usr/sbin/apache2

+ /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE USERDIR -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -t

+ ret=1

+ '[' 1 -ne 0 ']'

+ eerror 'apache2 has detected an error in your setup:'

 * apache2 has detected an error in your setup:

+ /usr/sbin/apache2 -D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE USERDIR -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -t

Usage: /usr/sbin/apache2 [-D name] [-d directory] [-f file]

                         [-C "directive"] [-c "directive"]

                         [-k start|restart|graceful|graceful-stop|stop]

                         [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S]

Options:

  -D name            : define a name for use in <IfDefine name> directives

  -d directory       : specify an alternate initial ServerRoot

  -f file            : specify an alternate ServerConfigFile

  -C "directive"     : process directive before reading config files

  -c "directive"     : process directive after reading config files

  -e level           : show startup errors of level (see LogLevel)

  -E file            : log startup errors to file

  -v                 : show version number

  -V                 : show compile settings

  -h                 : list available command line options (this page)

  -l                 : list compiled in modules

  -L                 : list available configuration directives

  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)

  -S                 : a synonym for -t -D DUMP_VHOSTS

  -t -D DUMP_MODULES : show all loaded modules 

  -M                 : a synonym for -t -D DUMP_MODULES

  -t                 : run syntax check for config files

  -T                 : start without DocumentRoot(s) check

+ return 1

+ return 1

+ exit 1

 * ERROR: apache2 failed to start

```

----------

## quilosaq

Apache no consigue resolver la dirección IP del nodo "gentoomaxi" que supongo que es el propio ordenador en el que se está ejecutando. Tendrás que añadir la entrada correspondiente en el archivo  *Quote:*   

> /etc/hosts

 .

----------

## maximiliano3

mi /etc/hosts

```
# /etc/hosts: Local Host Database

#

# This file describes a number of aliases-to-address mappings for the for

# local hosts that share this file.

#

# In the presence of the domain name service or NIS, this file may not be

# consulted at all; see /etc/host.conf for the resolution order.

#

# IPv4 and IPv6 localhost aliases

10.10.1.100     gentoomaxy.gentoodominio gentoomaxy

::1             localhost

127.0.0.1     localhost

#

# Imaginary network.

#10.0.0.2               myname

#10.0.0.3               myfriend

#

# According to RFC 1918, you can use the following IP networks for private

# nets which will never be connected to the Internet:
```

y mi /etc/host

```

10.10.1.100 gentoomaxy

```

----------

## quilosaq

¿Qué devuelve 

```
ping -c3 gentoomaxy
```

?

----------

## maximiliano3

Me dio esto.

```

gentoomaxy ~ # ping -c3 gentoomaxy

PING gentoomaxy.gentoodominio (10.10.1.100) 56(84) bytes of data.

64 bytes from gentoomaxy.gentoodominio (10.10.1.100): icmp_req=1 ttl=64 time=0.036 ms

64 bytes from gentoomaxy.gentoodominio (10.10.1.100): icmp_req=2 ttl=64 time=0.019 ms

64 bytes from gentoomaxy.gentoodominio (10.10.1.100): icmp_req=3 ttl=64 time=0.018 ms

--- gentoomaxy.gentoodominio ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 1999ms

rtt min/avg/max/mdev = 0.018/0.024/0.036/0.009 ms

```

----------

## quilosaq

Creo que debe haber haber algo mal en el archivo de configuración de Apache. ¿Podrías publicar el archivo  *Quote:*   

> /etc/apache2/httpd.conf

 ?

----------

## maximiliano3

Tengo esto 

```

gentoomaxy ~ # cat /etc/apache2/httpd.conf 

# This is a modification of the default Apache 2.2 configuration file

# for Gentoo Linux.

#

# Support:

#   http://www.gentoo.org/main/en/lists.xml   [mailing lists]

#   http://forums.gentoo.org/                 [web forums]

#   irc://irc.freenode.net#gentoo-apache      [irc chat]

#

# Bug Reports:

#   http://bugs.gentoo.org                    [gentoo related bugs]

#   http://httpd.apache.org/bug_report.html   [apache httpd related bugs]

#

#

# This is the main Apache HTTP server configuration file.  It contains the

# configuration directives that give the server its instructions.

# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.

# In particular, see

# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>

# for a discussion of each configuration directive.

#

# Do NOT simply read the instructions in here without understanding

# what they do.  They're here only as hints or reminders.  If you are unsure

# consult the online docs. You have been warned.

#

# Configuration and logfile names: If the filenames you specify for many

# of the server's control files begin with "/" (or "drive:/" for Win32), the

# server will use that explicit path.  If the filenames do *not* begin

# with "/", the value of ServerRoot is prepended -- so "var/log/apache2/foo_log"

# with ServerRoot set to "/usr" will be interpreted by the

# server as "/usr/var/log/apache2/foo.log".

# ServerRoot: The top of the directory tree under which the server's

# configuration, error, and log files are kept.

#

# Do not add a slash at the end of the directory path.  If you point

# ServerRoot at a non-local disk, be sure to point the LockFile directive

# at a local disk.  If you wish to share the same ServerRoot for multiple

# httpd daemons, you will need to change at least LockFile and PidFile.

ServerRoot "/usr/lib/apache2"

# Dynamic Shared Object (DSO) Support

#

# To be able to use the functionality of a module which was built as a DSO you

# have to place corresponding `LoadModule' lines at this location so the

# directives contained in it are actually available _before_ they are used.

# Statically compiled modules (those listed by `httpd -l') do not need

# to be loaded here.

#

# Example:

# LoadModule foo_module modules/mod_foo.so

#

# GENTOO: Automatically defined based on APACHE2_MODULES USE_EXPAND variable.

#         Do not change manually, it will be overwritten on upgrade.

#

# The following modules are considered as the default configuration.

# If you wish to disable one of them, you may have to alter other

# configuration directives.

#

# Change these at your own risk!

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_alias_module modules/mod_authn_alias.so

LoadModule authn_anon_module modules/mod_authn_anon.so

LoadModule authn_dbm_module modules/mod_authn_dbm.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

<IfDefine AUTHNZ_LDAP>

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

</IfDefine>

LoadModule authz_dbm_module modules/mod_authz_dbm.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_owner_module modules/mod_authz_owner.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

<IfDefine CACHE>

LoadModule cache_module modules/mod_cache.so

</IfDefine>

LoadModule cgi_module modules/mod_cgi.so

LoadModule cgid_module modules/mod_cgid.so

<IfDefine DAV>

LoadModule dav_module modules/mod_dav.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_fs_module modules/mod_dav_fs.so

</IfDefine>

<IfDefine DAV>

LoadModule dav_lock_module modules/mod_dav_lock.so

</IfDefine>

LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

<IfDefine CACHE>

LoadModule disk_cache_module modules/mod_disk_cache.so

</IfDefine>

LoadModule env_module modules/mod_env.so

LoadModule expires_module modules/mod_expires.so

LoadModule ext_filter_module modules/mod_ext_filter.so

<IfDefine CACHE>

LoadModule file_cache_module modules/mod_file_cache.so

</IfDefine>

LoadModule filter_module modules/mod_filter.so

LoadModule headers_module modules/mod_headers.so

LoadModule include_module modules/mod_include.so

<IfDefine INFO>

LoadModule info_module modules/mod_info.so

</IfDefine>

<IfDefine LDAP>

LoadModule ldap_module modules/mod_ldap.so

</IfDefine>

LoadModule log_config_module modules/mod_log_config.so

LoadModule logio_module modules/mod_logio.so

<IfDefine CACHE>

LoadModule mem_cache_module modules/mod_mem_cache.so

</IfDefine>

LoadModule mime_module modules/mod_mime.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule speling_module modules/mod_speling.so

<IfDefine SSL>

LoadModule ssl_module modules/mod_ssl.so

</IfDefine>

<IfDefine STATUS>

LoadModule status_module modules/mod_status.so

</IfDefine>

LoadModule unique_id_module modules/mod_unique_id.so

<IfDefine USERDIR>

LoadModule userdir_module modules/mod_userdir.so

</IfDefine>

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

# If you wish httpd to run as a different user or group, you must run

# httpd as root initially and it will switch.

#

# User/Group: The name (or #number) of the user/group to run httpd as.

# It is usually good practice to create a dedicated user and group for

# running httpd, as with most system services.

User apache

Group apache

# Supplemental configuration

#

# Most of the configuration files in the /etc/apache2/modules.d/ directory can

# be turned on using APACHE2_OPTS in /etc/conf.d/apache2 to add extra features

# or to modify the default configuration of the server.

#

# To know which flag to add to APACHE2_OPTS, look at the first line of the

# the file, which will usually be an <IfDefine OPTION> where OPTION is the

# flag to use.

Include /etc/apache2/modules.d/*.conf

# Virtual-host support

#

# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we

# include a default vhost (enabled by adding -D DEFAULT_VHOST to

# APACHE2_OPTS in /etc/conf.d/apache2).

Include /etc/apache2/vhosts.d/*.conf

# vim: ts=4 filetype=apache

```

----------

## maximiliano3

apache2 -d start

apache2: apr_sockaddr_info_get() failed for gentoomaxy

apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

no listening sockets available, shutting down

Unable to open logs

----------

## quilosaq

Prueba a modificar /etc/hosts. Quita el alias gentoomaxy de la ip 10.10.1.100 y ponlo en la 127.0.0.1.

----------

## maximiliano3

Bien lo solucione. JEJE me costooo un montonnn pero hice esto que me ponen arriba, ahora que casi lo tengo no puedo ver la pagina me pasa esto 

Forbidden

You don't have permission to access / on this server.

Apache Server at 10.10.1.100 Port 80

----------

