LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-20-2014, 12:08 AM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Rep: Reputation: 61
Where are Apache2's start up logs?


Hi LQ,

When I try to launch apache2 I get this.

Code:
wh33t@Wh33tBox:/var/log/apache2$ sudo service apache2 restart
 * Restarting web server apache2                                                               AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.2. Set the 'ServerName' directive globally to suppress this message
                                                                                        [fail]
 * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Any ideas. I checked the logs in /var/logs/apache2/ and there doesn't appear to be Apache start up errors in those scripts.

Code:
wh33t@Wh33tBox:/var/log/apache2$ ls -l
total 1200
-rw-r----- 1 root adm 374948 Dec 18 19:23 access.log
-rw-r----- 1 root adm 632427 Dec 14 06:40 access.log.1
-rw-r----- 1 root adm      0 Dec 18 23:28 error.log
-rw-r----- 1 root adm 196644 Dec 14 06:40 error.log.1
-rw-r----- 1 root adm      0 Dec 14 06:40 other_vhosts_access.log
-rw-r----- 1 root adm   3554 Dec  6 19:37 other_vhosts_access.log.1
wh33t@Wh33tBox:/var/log/apache2$
I know the issue is because I'm trying to install some extensions and I'm sure I did something wrong but I want to know how to troubleshoot this on my own.
 
Old 12-20-2014, 03:24 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I know the issue is because I'm trying to install some extensions and I'm sure I did something wrong but I want to know how to troubleshoot this on my own.
You can try to start apache using the -e switch, so it logs the startup messages, e.g:
Code:
httpd -e debug
In this case the startup messages are also logged in apache error.log

Regards
 
Old 12-20-2014, 03:44 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by wh33t View Post
Code:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.2. Set the 'ServerName' directive globally to suppress this message
First of all errors warn you of a less than favorable condition. This one also shows you how to correct the error. Please do not ignore it, correct it before doing anything else.


Quote:
Originally Posted by wh33t View Post
I checked the logs in /var/logs/apache2/ and there doesn't appear to be Apache start up errors in those scripts.
Code:
wh33t@Wh33tBox:/var/log/apache2$ ls -l
Do understand that telling us and listing log file directory contents are different from actually showing log file entries. Also note Apache has a pre-flight check switch (-t) that could help diagnose common problems (but be aware it doesn't cover everything). Next to that (generally speaking) log file contents may also be influenced by (absence of) debug (-X) or verbosity settings (-e) or any filtering that's done between the actual error and writing log file contents. To elaborate on what bathory wrote: your letters du Jour are: -{S,t,X,e}, the order and usage of which you can find in 'man httpd' or your Linux distribution equivalent.
 
Old 12-21-2014, 02:13 PM   #4
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Red face

Quote:
Originally Posted by bathory View Post
You can try to start apache using the -e switch, so it logs the startup messages, e.g:
Code:
httpd -e debug
In this case the startup messages are also logged in apache error.log

Regards
I tried the debug,

Code:
wh33t@Wh33tBox:/var/log$ httpd -e debug
No command 'httpd' found, did you mean:
 Command 'xttpd' from package 'xtide' (universe)
 Command 'http' from package 'httpie' (universe)
 Command 'https' from package 'httpie' (universe)
httpd: command not found
wh33t@Wh33tBox:/var/log$
Here is my default server.conf

Code:
<VirtualHost *:81>
        # The ServerName directive sets the request scheme, hostname and port t$
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName someserver.dyndns.net

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Here is my one subdomain.conf

Code:
<VirtualHost *:81>
        # The ServerName directive sets the request scheme, hostname and port t$
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName sub.someserver.dyndns.net

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/sub

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
And here is me trying to start the server

Code:
wh33t@Wh33tBox:/var/log/apache2$ sudo service apache2 restart
 * Restarting web server apache2                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.2. Set the 'ServerName' directive globally to suppress this message
                                                                         [fail]
 * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
And here is where the error log is being written. Note, before making this forum post I deleted access.log and error.log to simply trying to find the error messages.

Code:
wh33t@Wh33tBox:/var/log/apache2$ ls -l
total 828
-rw-r--r-- 1 root root      0 Dec 21 12:09 access.log
-rw-r----- 1 root adm  632427 Dec 14 06:40 access.log.1
-rw-r--r-- 1 root root      0 Dec 21 12:09 error.log
-rw-r----- 1 root adm  196644 Dec 14 06:40 error.log.1
-rw-r----- 1 root adm       0 Dec 14 06:40 other_vhosts_access.log
-rw-r----- 1 root adm    3554 Dec  6 19:37 other_vhosts_access.log.1
And the contents of error.log is empty.

I know I need to make apache2 output the errors, but not sure how. I need really straight forward instructions unfortunately. I'm using Ubuntu 14.04LTS if that's good to know.
 
Old 12-21-2014, 06:19 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by wh33t View Post
Code:
wh33t@Wh33tBox:/var/log$ httpd -e debug
No command 'httpd' found,
You're using a Debian derivative so it's "/usr/sbin/apache2". Try again. Please familiarize yourself with what you run.


Quote:
Originally Posted by wh33t View Post
Code:
<VirtualHost *:81>
        ServerName someserver.dyndns.net
Does "someserver.dyndns.net" resolve to your box publicly or by way of /etc/hosts? Also read https://help.ubuntu.com/community/Ap...hooting_Apache


Quote:
Originally Posted by wh33t View Post
And here is where the error log is being written. Note, before making this forum post I deleted access.log and error.log to simply trying to find the error messages.
Rotating logs out of the way using 'logrotate' or Apache's own tools OK, but deleting logs? No, that's not a good practice.


Quote:
Originally Posted by wh33t View Post
And the contents of error.log is empty.
That's because you did not explicitly set a LogLevel in your configuration. I don't know what it defaults to then so until you find out do set it. See http://httpd.apache.org/docs/2.2/mod/core.html#loglevel


Quote:
Originally Posted by wh33t View Post
I know I need to make apache2 output the errors, but not sure how.
The stderr message literally tells you what to do so please read carefully. I think you've got enough pointers now, right?
 
Old 12-22-2014, 02:13 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Just to add to the unSpawn's post above:
httpd is indeed replaced by apache2 in ubuntu, so try:
Code:
/usr/sbin/apache2 -e debug

Quote:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.1.2. Set the 'ServerName' directive globally to suppress this message
since you're still get this warning (not an error though) while you have a ServerName directive in both your vhosts config, chances are that apache does not read the respective config files.
You need to run a2ensite to enable vhost(s), so have a look at step 5 in this howto
I guess for the same reason you don't get any logs written in error.log

Regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what does this do in my apache2 access logs charly78 Linux - Security 8 09-29-2014 09:56 PM
[SOLVED] BASH: service apache2 start => check apache2 response dragonetti Linux - Newbie 2 10-29-2011 11:01 AM
apache2 logs Redhat 4 tractng Red Hat 3 02-10-2008 11:19 AM
Apache2 Logs vital_101 Ubuntu 2 12-06-2006 01:12 PM
Where are the Apache2 logs? vous Linux - Software 1 02-04-2004 03:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration