Minimal configuration file for Apache on Ubuntu
There’s CppCMS, a “High Performance C++ Web Framework”. This looks very interesting, but couldn’t this be done by an Apache module?
I searched and found this tutorial at Developing modules for the Apache HTTP Server 2.4. I wanted to play with this, but not use my regular Apache installation for debugging purposes. Again, using my preferred search engine, I found this Github Gist zroger/httpd.conf.
As always, it doesn’t run as smooth as I like. Apache complained immediately about a missing module
apache2: Syntax error on line 28 of ./httpd.conf: Cannot load /usr/libexec/apache2/mod_authz_host.so into server: /usr/libexec/apache2/mod_authz_host.so: cannot open shared object file: No such file or directory
Changing paths from
/usr/lib/apache2/modules fixes the first problem. Alternatively, you
can reuse Ubuntu’s installation and include configuration files
Include /etc/apache2/mods-available/authz_host.load Include /etc/apache2/mods-available/rewrite.load
and so on.
Next error message was
apache2: Syntax error on line 40 of ./httpd.conf: module log_config_module is built-in and can’t be loaded
Removing this line and the line loading PHP, brings us to
AH00534: apache2: Configuration error: No MPM loaded.
Searching for this error message didn’t help, but looking into
mpm_prefork.conf. So, including these two
Include /etc/apache2/mods-available/mpm_prefork.load Include /etc/apache2/mods-available/mpm_prefork.conf
helps overcome this error. And on to the next one
AH00526: Syntax error on line 21 of ./httpd.conf:
Invalid command ‘LockFile’, perhaps misspelled or defined by a module not included in the server configuration
Apache2 - Upgrading to 2.4 from 2.2
Upgraded to Ubuntu 13.10 - Apache not able to start,
I must change
Mutex file:tmp default
AH00526: Syntax error on line 66 of ./httpd.conf:
Invalid command ‘Order’, perhaps misspelled or defined by a module not included in the server configuration
In Apache 2.4, this is solved by module
Since I want a really minimal configuration, I remove all the
LoadModule entries, the PHP parts and the final
This leaves us with a final error
(2)No such file or directory: AH00089: Couldn’t start ErrorLog process ‘cat’.
AH00015: Unable to open logs
which can be remedied by giving an absolute path, which is
/bin/cat on my system
ErrorLog "|/bin/cat" ... CustomLog "|/bin/cat" common
If you prefer logging output in a file, you can also remove these
lines and create a directory
logs, where the logging files will be
This is all well now, until you try loading some web page. This results in yet another “Internal Server Error”. Log output says
AH00025: configuration error: couldn’t check user: /
This is something, which changed from Apache version 2.2 to
version 2.4. Module
authz_core solves this one. And finally, I can
load my first page
This is just a start, you must add modules for your environment, of course. And I can start with creating my own Apache module.
And here is the final minimal configuration file:
ServerName localhost Listen 8080 PidFile tmp/httpd.pid Mutex file:tmp default Include /etc/apache2/mods-available/authz_core.load Include /etc/apache2/mods-available/access_compat.load Include /etc/apache2/mods-available/mpm_prefork.load Include /etc/apache2/mods-available/mpm_prefork.conf LogLevel info ErrorLog "|/bin/cat" LogFormat "%h %l %u %t \"%r\" %>s %b" common CustomLog "|/bin/cat" common DocumentRoot "build" <Directory "build"> AllowOverride all Order allow,deny Allow from all </Directory>