Home ›
Documented Apache virtual host for Drupal developmentDocumented Apache virtual host for Drupal development
Submitted by Stefan Freudenberg on December 20, 2011 - 2:07pm
We at Agaric develop Drupal on Apache2 web server with mod_rewrite enabled running on Debian GNU/Linux. Here's a sample configuration for a project located on the same filesystem at /path/to/drupal/root. That's where the index.php file is.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName project.domain
To access the website at project.domain in a browser on your local computer a DNS entry in /etc/hosts is needed:
127.0.0.1 project.domain
DocumentRoot /path/to/drupal/root
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /path/to/drupal/root>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
The directory directive matching the DocumentRoot has the most important configuration, notably AllowOverride All which enables the URL rewriting in Drupal's .htacess. It's also necessary to have mod_rewrite enabled as a prerequisite for this.
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log vhost_combined
</VirtualHost>
Comments
Post new comment