Httpd – “Unable to open logs” in apache error log debian

apache-2.2apache-2.4httpd

[SOLVED] Higher file descriptor limit solved the issue

APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

I'm unable to start apache2 service:

[root@myhost ~]# service apache2 start
[....] Starting web server: apache2[Thu May 22 00:32:41 2014] [warn] NameVirtualHost *:443 has no VirtualHosts
Action 'start' failed.
The Apache error log may have more information.
 failed!
[root@myhost ~]#

/var/log/apache2/error.log

[root@myhost ~]# tail -200 /var/log/apache2/error.log

(...)
Unable to open logs
Unable to open logs
Unable to open logs
Unable to open logs
Unable to open logs
Unable to open logs
Unable to open logs
Unable to open logs
[root@myhost ~]#

Permissions:

[root@myhost /var/log/apache2]# ls -l
total 14892
-rw-r----- 1 root adm        379215 May 21 23:34 access.log
-rw-r----- 1 root adm       1583118 May 18 07:35 access.log.1
-rwxrwxrwx 1 root root          163 May 22 00:32 error.log
-rw-r----- 1 root adm      13096039 May 18 07:35 error.log.1
-rw-r----- 1 root adm          3423 May 21 22:27 other_vhosts_access.log
-rw-r--r-- 1 root root       153149 May 18 04:46 other_vhosts_access.log.1
-rw-r----- 1 root adm             0 May 18 07:35 suexec.log
-rw-r--r-- 1 root www-data     1620 May 16 13:08 suexec.log.1
[root@myhost /var/log/apache2]#

/etc/apache2/envvars

# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
        SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'


## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''

Any ideas?

Thanks

Best Answer

Higher file descriptor limit in /etc/apache2/envvars solved the issue

APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'
Related Topic