Changes

Jump to: navigation, search

Package:Apache

1,300 bytes added, 4 years ago
m
Updated the /etc/conf.d/apache2 information to reflect the changes for new PHP versions.
*<code>/etc/apache2/vhosts.d/*</code>
<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>
{{file|name=/etc/conf.d/apache2|lang=|desc=enable php dso module|body=
"... -D PHP5PHP"
}}
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://127.0.0.1:9000/var/www/localhost/htdocs/$1
DirectoryIndex /index.php
...
}}
 
Do not forget to start php-fpm:
{{console|body=###i## rc-update add php-fpm default
rc}}
=== Enabling Security Module ===
== Service ==
To start Apache immediatelytemporarily:
<console>
###i## rc-service apache2 start
</console>
To start Apache upon immediately, and every boot:
<console>
###i## rc-update add apache2default###i## rc
</console>
wiki-users
97
edits

Navigation menu