File elgg_apache.conf of Package elgg
#
# Configuration for Elgg
#
# to enable this configuration, please set
# APACHE_SERVER_FLAGS="ELGG" in /etc/sysconfig/apache2
# manually or via "a2enflag ELGG"
#
<IfDefine ELGG>
Alias __ELGG_WEBROOT__ __ELGG_ROOT__
DirectoryIndex index.php
<Directory "__ELGG_ROOT__">
Options -Indexes +FollowSymLinks
<IfModule mod_mime.c>
AddType image/vnd.microsoft.icon .ico
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 year"
</IfModule>
<FilesMatch "\.(jpg|jpeg|gif|png|mp3|flv|mov|avi|3pg|html|htm|swf|js|css|ico)$">
FileETag MTime Size
</FilesMatch>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_gzip.c>
mod_gzip_on yes
mod_gzip_dechunk yes
mod_gzip_keep_workfiles No
mod_gzip_minimum_file_size 1000
mod_gzip_maximum_file_size 1000000
mod_gzip_maximum_inmem_size 1000000
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
# Exclude old browsers and images since IE has trouble with this
mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\["
mod_gzip_item_exclude mime ^image/.*
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript image/svg+xml
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.[0678] no-gzip
BrowserMatch \bMSIE !no-gzip
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
SetEnvIfNoCase Request_URI action\/* no-gzip dont-vary
SetEnvIfNoCase Request_URI actions\/* no-gzip dont-vary
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
# If Elgg is in a subdirectory on your site, you might need to add a RewriteBase line
# containing the path from your site root to elgg's root. e.g. If your site is
# http://example.com/ and Elgg is in http://example.com/sites/elgg/, you might need
#
#RewriteBase /sites/elgg/
#
# here, only without the # in front.
#
# If you're not running Elgg in a subdirectory on your site, but still getting lots
# of 404 errors beyond the front page, you could instead try:
#
#RewriteBase /
RewriteRule (^\.|/\.) - [F]
RewriteRule ^cache\/(.*)$ engine/handlers/cache_handler.php?request=$1&%{QUERY_STRING} [L]
RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/?$ engine/handlers/export_handler.php?view=$1&guid=$2 [L]
RewriteRule ^export\/([A-Za-z]+)\/([0-9]+)\/([A-Za-z]+)\/([A-Za-z0-9\_]+)\/$ engine/handlers/export_handler.php?view=$1&guid=$2&type=$3&idname=$4 [L]
# rule for rewrite module test during install - can be removed after installation
RewriteRule ^rewrite.php$ install.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?__elgg_uri=$1 [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_admin_flag magic_quotes_gpc Off
php_admin_flag magic_quotes_runtime Off
php_admin_flag register_globals Off
php_admin_flag allow_url_include Off
php_admin_flag safe_mode Off
php_admin_flag short_open_tag Off
php_admin_flag allow_url_fopen On
php_admin_flag file_uploads On
# Max. file sizes to transfer via Webfrontend
php_admin_value upload_max_filesize 16M
php_admin_value post_max_size 16M
php_admin_value memory_limit "256M"
php_admin_value session.save_handler files
php_admin_value display_errors Off
# directories
php_admin_value session.save_path "__ELGG_SESSIONDIR__"
php_admin_value upload_tmp_dir "__ELGG_TMPDIR__"
php_admin_value open_basedir "__ELGG_ROOT__:__ELGG_TMPDIR__:__ELGG_SESSIONDIR__:__ELGG_DATADIR__:/tmp"
</IfModule>
<IfModule mod_php7.c>
php_admin_flag magic_quotes_gpc Off
php_admin_flag magic_quotes_runtime Off
php_admin_flag register_globals Off
php_admin_flag allow_url_include Off
php_admin_flag safe_mode Off
php_admin_flag short_open_tag Off
php_admin_flag allow_url_fopen On
php_admin_flag file_uploads On
# Max. file sizes to transfer via Webfrontend
php_admin_value upload_max_filesize 16M
php_admin_value post_max_size 16M
php_admin_value memory_limit "256M"
php_admin_value session.save_handler files
php_admin_value display_errors Off
# directories
php_admin_value session.save_path "__ELGG_SESSIONDIR__"
php_admin_value upload_tmp_dir "__ELGG_TMPDIR__"
php_admin_value open_basedir "__ELGG_ROOT__:__ELGG_TMPDIR__:__ELGG_SESSIONDIR__:__ELGG_DATADIR__:/tmp"
</IfModule>
</Directory>
</IfDefine>