There are several ways to setup Wordpress & Apache in Debian. However the
maintainer's recommended way with the helper script `setup-mysql` uses:
## Virtual host VirtualDocumentRoot
NameVirtualHost *:80
UseCanonicalName Off
VirtualDocumentRoot /usr/share/wordpress
Options All
# wp-content in /srv/www/wp-content/$0
RewriteEngine On
RewriteRule ^/wp-content/(.*)$ /srv/www/wp-content/%{HTTP_HOST}/$1
For this configuration to work you'll also need to have mod_rewrite
and mod_vhost_alias loaded and working in Apache.
To enable these modules run
a2enmod rewrite && a2enmod vhost_alias && /etc/init.d/apache2 restart
The above example is checked. Here are some _alternative_ suggestions:
## A defined Virtual host
NameVirtualHost *:80
ServerName blog.example.com
DocumentRoot /usr/share/wordpress/
DirectoryIndex index.php index.html
ErrorLog /var/log/apache2/wp-error.log
TransferLog /var/log/apache2/wp-access.log
# wp-content in /var/lib/wordpress/wp-content
Alias /wp-content /var/lib/wordpress/wp-content
Options FollowSymLinks
Require all granted
Options FollowSymLinks
Require all granted
## Without using Virtual host, hosted off /blog
Alias /blog/wp-content /var/lib/wordpress/wp-content
Alias /blog /usr/share/wordpress
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
Options FollowSymLinks
Require all granted
# Tips
If permalinks or rewrite is not working you might need:
Options FollowSymLinks
AllowOverride All
If NameVirtualHost *:80 is not working, you probably need to replace the * with
the actual IP or hostname of your server.