Jump to: navigation, search


656 bytes added, 4 years ago
Updated the /etc/conf.d/apache2 information to reflect the changes for new PHP versions.
== Install ==
=== Configure USE Flags ==={| class="wikitable" style="margin: 1em auto;" width=80%! width="20%" | Use Depending upon one's personal preferences, flag! width="10%" | Default! width="10%" | Recommended! width="60%" | Description|-| style="text-align: center;" | debug| style="text-align: center;" | No| style="text-align: center; background-color: red;" | No| style="text-align: center;" | Enable extra debug codepathschanges are sometimes necessary. To extend default USE flags in an Apache ebuild, like asserts and extra outputcompile a custom flavor. This can be achieved by Portage's <code>package. If you want to get meaningful backtraces see http:use<//wwwcode>.gentoo.orgCreate a directory <code>/projetc/enportage/qa/backtraces.xml.|-| style="text-align: center;" | doc| style="text-align: center;" | No| style="text-align: center;" | | style="text-align: center;" | Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally|-| style="text-align: center;" | ldap| style="text-align: center;" | No| style="text-align: center;" || style="text-align: center;" | Add LDAP support (Lightweight Directory Access Protocol).|-| style="text-align: center;" | selinux| style="text-align: center;" | No| style="text-align: center; background-color: yellow" | No, unless selected by default.| style="text-align: center;" | !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur|-| style="text-align: center;" | ssl| style="text-align: center;" | Yes| style="text-align: center;" || style="text-align: center;" | Add support for Secure Socket Layer connections.|-| style="text-align: center;" | static| style="text-align: center;" | No| style="text-align: center;" || style="text-align: center;" | !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically.|-| style="text-align: center;" | threads| style="text-align: center;" | No| style="text-align: center;" || style="text-align: center;" | Add threads support for various packages. Usually pthreads.|} If you want to enable any of the above use flags, create a </code> and file called <ttcode>/etc/portage/package.use/apache</ttcode> , and add the options that USE flags you want to enable to it. For example:<console>###i## install -d /etc/portage/package.use</console>
{{file|name=/etc/portage/package.use/apache|desc= |body=
www-servers/apache ssl threads
Alternatively, if one prefers a <code>/etc/portage/package.use</code> flat file:<console>###i## echo 'www-servers/apache ssl threads' >> /etc/portage/package.use</console>
=== Emerge ===
After you have configured the configuring your preferred USE flags that you want to build Apache with, emerge itApache:
<console>###i## emerge apache</console>
== Configuration ==
=== System ===
Many packages have apache2 use Apache2 USE flags. These use USE flags are often required for an application to be supported by Apache. Setting a system wide apache2 use Apache2 USE flag is a good idea.
{{file|name=/etc/portage/make.conf|desc=set system wide apache2 useflag|body=
<code>conf.d</code> controls the init script, adding things to it such as -D SECURITY & -D PHP5 PHP will enable web application fire-walling & the php scripting language.
<code>httpd.conf</code> controls how the server behaves, at the bottom of the file it has directives to include configuration files ending in .conf in <code>/etc/apache2/modules.d</code> and <code>/etc/apache2/vhosts.d</code>
=== {{package|dev-lang/php}} ===
==== DSO / mod_php ====
To show which PHP versions are available for Apache on your system:
<console>###i## eselect php list apache2
[1] php5.5
[2] php5.6 *
To select PHP 5.5:
<console>###i## eselect php set apache2 php5.5</console>
{{file|name=/etc/conf.d/apache2|lang=|desc=enable php dso module|body=
"... -D PHP"
Restart Apache:
<console>###i## rc-service apache2 restart</console>
If php code is showing instead of processing server side, ensure you have emerged app-eselect/eselect-php with the apache2 useflag.
==== Php-fpm ====
Apache supports php-fpm also, this is the preferred method to serve php.
{{file|name=/etc/portage/make.conf|lang=|desc=enable proxy & fcgi modules|body=
APACHE2_MODULES="actions alias auth_basic auth_digest authn_alias authn_anon authn_core authn_dbm authn_file authz_core authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias proxy proxy_fcgi"
{{file|name=/etc/conf.d/apache2|lang=|desc=enable proxy module|body=
"... -D PROXY"
{{file|name=/etc/apache2/vhosts.d/00_default_vhost.conf|lang=|desc=configure php-fpm vhosts.|body=
<VirtualHost *:80>
ServerName localhost
Include /etc/apache2/vhosts.d/default_vhost.include
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://$1
DirectoryIndex /index.php
Do not forget to start php-fpm:
{{console|body=###i## rc-update add php-fpm default
=== Enabling Security Module ===
<console>###i## emerge mod_security</console>
{{file|name=/etc/conf.d/apache2|lang=|desc=enable mod_security|body=
Control this module by editing these files, and restarting Apache.
<code>/etc/apache2/modules.d/79_modsecurity.conf</code> & <code>/etc/apache2/modules.d/80_modsecurity-crs.conf</code>
== Service ==
To start apache immediatelyApache temporarily:
###i## rc-service apache2 start
To start apache upon Apache immediately, and every boot:
###i## rc-update add apache2default###i## rc
Then point your browser to You should see that the text from rewrite.html has been loaded.

Navigation menu