Apache config

Last updated on
20 April 2024

This documentation needs review. See "Help improve this page" in the sidebar.

Make sure you have the following modules enabled in Apache for this configuration to work properly:

  • mod_rewrite for URL rewriting.
  • mod_proxy_fcgi to manage FastCGI requests.
  • mod_expires for management of Expires headers.

Example virtualhost (untested) converted from the nginx example using ChatGPT.

<VirtualHost *:80>
    ServerName mydomain.com
    DocumentRoot /srv/www/mydomain.com/public_html
    ErrorLog /srv/www/mydomain.com/logs/error.log
    CustomLog /srv/www/mydomain.com/logs/access.log combined

    <Directory /srv/www/mydomain.com/public_html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    RewriteEngine On
    RewriteRule ^/admin/(.*)$ /index.php [L]

    <FilesMatch "^(.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|test|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$">
        Require all denied
    </FilesMatch>

    <FilesMatch \.html$>
        ExpiresActive On
        ExpiresDefault "access plus 1 year"
    </FilesMatch>

    <FilesMatch \.php$>
        SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>

    ProxyPassHeader Set-Cookie
    ProxyPassHeader Cookie
    RequestHeader unset Accept-Encoding

    <IfModule mod_headers.c>
        Header append X-Boost-Cache "full"
    </IfModule>
</VirtualHost>

Help improve this page

Page status: Needs review

You can: