In this article, I will examine what apache is how to setup apache for ubuntu or debian and how to view error logs for apache and how to understand what the logs contain which will be useful for web development.
What is Apache?
Apache is the most popular web server on the internet. It is used to serve more than half of all active websites.
It is fast, reliable, and secure. It can be highly customized to meet the needs of many different environments by using extensions and modules.
Installing Apache on Ubuntu and Debian
If you do not already have Apache installed, you can do so now by issuing the following commands:
sudo apt-get update sudo apt-get install apache2
If you visit your VPS’s IP address in a web browser, you will get the default Apache index page. We get the following output.
your_domain_name_or_ip_address
It works! This is the default web page for this server. The web server software is running but no content has been added, yet.
Looking into apache error.log files
In order to effectively manage a web server, it is necessary to get feedback about the activity and performance of the server as well as any problems that may be occuring. The Apache HTTP Server provides very comprehensive and flexible logging capabilities.
Error.log file
The server error log, whose name and location is set by the ErrorLog directive, is the most important log file. This is the place where Apache httpd will send diagnostic information and record any errors that it encounters in processing requests.
It is the first place to look when a problem occurs with starting the server or with the operation of the server, since it will often contain details of what went wrong and how to fix it.
Explanation of log message
There is certain information that is contained in most error log entries. For example, here is a typical message.
[Sat Aug 20 08:09:38.958885 2016] [:error] [pid 1489] [client 127.0.0.1:40810] PHP Notice: Constant MIN_PASSWORD_LENGTH already defined in /var/www/html/test/engelsystem/config/config.php on line 30, referer: http://localhost/
[Sat Aug 20 08:09:38.958885 2016] The first item in the log entry is the date and time of the message.
[:error] The second entry lists the severity of the error being reported.
[pid 1489] Indicates process Id
[client 127.0.0.1:40810] The fourth entry gives the IP address of the client that generated the error.
Fifth one is error message explaining the error.
Constant MIN_PASSWORD_LENGTH already defined.
File and line number
/var/www/html/test/engelsystem/config/config.php on line 30
Error logs are easy to understand. Using error logs we can easily figure out the problem in your server or your code and fix it.
For more information about the log files and configuration please visit Apache website Apache provides excellent documentation.
Apache log files were useful for me during web development project Engelsystem. We are developing new features. Interested developers can work with us.
Development: https://github.com/fossasia/engelsystem
Issues/Bugs:https://github.com/fossasia/engelsystem/issues
Pingback: Engelsystem GSoC 2016 Summary | FOSSASIA