User login

Documented Apache virtual host for Drupal development

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

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.