Revision as of 02:09, September 16, 2014 by Duncan.britton (Talk | contribs)


Current Maintainer(s):polynomial-c@gentoo.org
Source Repository:Repository:Gentoo Portage Tree


Summary: The Apache Web Server

Use Flags

Install suexec with apache
Link in apache2 modules statically rather then plugins
Group authorizations based on host (name or IP address). Available as a compatibility module with previous versions.
Provides core authentication capabilities common to all authentication providers (functionality provided by authn_alias in previous versions).
Provides core authorization capabilities to various authorization/authorization modules, such as authn_file and authz_user.
Provides authorization capabilities via SQL database so that authenticated users can be allowed or denied access to portions of the web site by group membership.
Disk based storage module for the HTTP caching filter (similar to mem_cache in previous versions).
Module to rewrite links in html pages behind a reverse proxy
Enable http2/alpn module
Request counting load balancer scheduler algorithm for proxy_balancer.
Weighted traffic counting load balancer scheduler algorithm for proxy_balancer.
Pending request counting load balancer scheduler algorithm for proxy_balancer.
Heartbeat traffic counting load balancer scheduler algorithm for proxy_balancer.
Macros for the Apache config file.
Slot-based shared memory provider.
A shared object cache provider using a high-performance cyclic buffer inside a shared memory segment.
Basic (required) security for Unix-family platforms.
FCGI support module for mod_proxy.
Provides support for the tunnelling of web socket connections to a backend websockets server.
Ratelimit module for transfer rate management
Remotip module for logging



PHP and Kernel Updates

PHP and Kernel Updates
2016-04-01 by Oleg

OpenSSL Update

OpenSSL Update
2016-03-04 by Oleg

Python Updates

Python Updates
2016-02-12 by Oleg



We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

Apache is a powerful web server which serves html/css/cgi/pl out of the box, and can serve other languages/frameworks via extensions.

The Apache Homepage says this of Apache:

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.


USE Flags

Use flag Default Recommended Description
debug No No Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml.
doc No Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
ldap No Add LDAP support (Lightweight Directory Access Protocol).
selinux No No, unless selected by default.  !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
ssl Yes Add support for Secure Socket Layer connections.
static No  !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically.
threads No Add threads support for various packages. Usually pthreads.

If you want to enable any of the above use flags, create a file called /etc/portage/package.use/apache and add the options that you want to enable to it. For example:

www-servers/apache ssl threads


After you have configured the USE flags that you want to build Apache with, emerge it:

# emerge apache



Many packages have apache2 use flags. These use flags are often required for an application to be supported by Apache. Setting a system wide apache2 use flag is a good idea.

/etc/portage/make.conf - set system wide apache2 useflag


Apache's configuration files are broken up and located in several spots.

  • /etc/conf.d/apache2
  • /etc/apache2/httpd.conf
  • /etc/apache2/modules.d/*
  • /etc/apache2/vhosts.d/*

conf.d controls the init script, adding things to it such as -D SECURITY & -D PHP5 will enable web application fire-walling & the php scripting language.

httpd.conf controls how the server behaves, at the bottom of the file it has directives to include configuration files ending in .conf in /etc/apache2/modules.d and /etc/apache2/vhosts.d


To start apache immediately:

# rc-service apache2 start

To start apache upon boot:

# rc-update add apache2


What is mod_rewrite?

The Apache documentation describes mod_rewrite as:

The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.

Setting it up

mod_rewrite has a reputation of being difficult to set up. mod_rewrite requires following symlinks & Order allow,deny (apache 2.2) or Require all granted (apache 2.4) is set. To test functionality of mod_rewrite we will need to make a few files.


If you want to test this for web applications such as mediawiki adjust the path to /var/www/localhost/htdocs/mediawiki/.htaccess & so on

/var/www/localhost/htdocs/.htaccess - enable the rewrite engine
RewriteEngine on 
RewriteRule ^test.html$ rewrite.html
/var/www/localhost/htdocs/test.html - set system wide apache2 useflag
rewrite is not working
/var/www/localhost/htdocs/rewrite.html - set system wide apache2 useflag
rewrite is working

Then point your browser to You should see that the text from rewrite.html has been loaded.