Once you have installed Apache on Ubuntu, you will probably want to customize it. While the previous page on configuring Apache's modules gives you a good overview of the process, we will start to go in-depth about Apache's configuration file on this page.
Apache's server-wide configuration is in /etc/apache2/apache2.conf. You can browse to that location through the terminal, through a file manager, or through the open file dialogue of a text editor (gedit, kate, emacs, vi). When you first open it, the amount of verbage can look rather daunting. In fact, most of it is commentary. When all the comments and remarks are taken away, the average Apache configuration looks something like this:
ServerRoot "/etc/apache2"You can use the links to get a description about each directive or just go to the discussion Apache's most common directives. There are over 85 different options that you can include in an Apache configuration file. Many of them are not needed for the average installation. This file shows you one of the most basic, fully-functional Apache files that you can use on Ubuntu.
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
<\/IfModule>
<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
ThreadsPerChild 25
MaxRequestsPerChild 0
<\/IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
<\/Files>
DefaultType text/plain
HostnameLookups Off
ErrorLog /var/log/apache2/error.log
LogLevel warn
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
Include /etc/apache2/httpd.conf
Include /etc/apache2/ports.conf
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
ServerTokens Full
ServerSignature On
Include /etc/apache2/conf.d/
Include /etc/apache2/sites-enabled/
Apache Tutorials:
Install Apache | Basic Configuration | Apache In-Depth |
Recommend Web Hosting | Customising Apache | PHP Hosting |
MySQL Tutorials:
Install MySQL | Basic MySQL Configuration | MySQL Configuration In-Depth |