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_rewritefor URL rewriting.mod_proxy_fcgito manage FastCGI requests.mod_expiresfor 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:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion
Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.