Wordpress Installation on Debian
From Debian Wiki
Contents |
Introduction
This HOWTO will show you how to install Wordpress (version 2.3.1) from the Debian package manager as well as configure a Wordpress blog for multiple domains. Please note that there are other HOWTOs available for setting up Wordpress on Debian Etch but this is the method that worked best for me. YMMV.
Requirements
- A Debian Etch base installation - Installation HOWTO here.
- Root access to your server.
Assumptions
For this HOWTO we'll assume that you want to install your Wordpress blog for www.example.com and that your server's IP address is 192.168.1.2. Any reference to www.example.com or 192.168.1.2 must be replaced with your domain name and server's IP address respectively.
Install Wordpress
apt-get update && apt-get upgrade apt-get install wordpress
Modify The htaccess File
Open up the Wordpress htaccess file:
vim /etc/wordpress/htaccess
Add the following to the file - make sure you only add what isn't there already:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^.*$ http://%1%{REQUEST_URI} [QSA,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Save and close the file.
Create Apache Config Files
vim /etc/apache2/sites-available/example.com
Add the following to your first new file:
<VirtualHost 192.168.1.2:80> ServerName example.com ServerAdmin me@example.com DocumentRoot /var/www/example.com DirectoryIndex index.php <Directory /var/www/example.com/> AllowOverride All Order Deny,Allow Allow from all </Directory> </VirtualHost>
Save this file and create the following new one:
/etc/apache2/sites-available/www.example.com
Add the following to your second new file:
<VirtualHost 192.168.1.2:80> ServerName www.example.com ServerAdmin me@example.com DocumentRoot /var/www/example.com DirectoryIndex index.php <Directory /var/www/example.com/> AllowOverride All Order Deny,Allow Allow from all </Directory> </VirtualHost>
Once you've saved this second file you should see two new files in /etc/apache2/sites-available/ namely example.com and www.example.com.
Create A Symbolic Link To Your Wordpress Files
cd /var/www/ ln -s /usr/share/wordpress example.com
Enable Your New Sites
a2ensite www.example.com a2ensite example.com /etc/init.d/apache2 restart
Setup MySQL Database & Wordpress Config File
The following command will setup a new database and create a config file at /etc/wordpress/config-example.com.php.
/usr/share/doc/wordpress/examples/setup-mysql -n example example.com
Replace "example" in the command above to the name of your database and "example.com" to the domain name for your website.
Setup Wordpress
Once you've completed these you can now go to www.example.com and you'll see a new Wordpress Install screen. Simply follow the steps and you're new Wordpress website will be live and ready to go.
If you'd like to add additional Wordpress blog sites then follow steps 6 through 10 for each additional domain name. |