Professional Documents
Culture Documents
How To Host Multiple Sites in A Single Wordpress Installation On Ubuntu 14.04
How To Host Multiple Sites in A Single Wordpress Installation On Ubuntu 14.04
How To Host Multiple Sites in A Single Wordpress Installation On Ubuntu 14.04
1 Preliminary Note
This tutorial is based on Ubuntu 14.04 server, so you should set up a basic Ubuntu
14.04 server installation before you continue with this tutorial. The system should have
a static IP address. I use 192.168.0.100 as my IP address in this tutorial
and server1.example.com as the hostname. You must have a LAMP server installed in
Ubuntu 14.04 as mentioned in the tutorial to continue further.
2 Database initialization
I will create the database for the WordPress 4.0 as follows:
mysql -u root -p
FLUSH PRIVILEGES;
exit
Restart services
mkdir temp
cd temp
wget http://wordpress.org/latest.zip
Further moving ahead if you wish to work with images, install plugins and site updation
with SSH credentials then we will install php5-gd libssh2-php
apt-get update
apt-get install php5-gd libssh2-php
Further we need to manually create the uploads directory beneath the wp-content
directory at our document root. This will be the parent directory of our content:
mkdir -p /var/www/html/wordpress/wp-content/uploads
We need to allow the web server itself to write to this directory. We can do this by
assigning group ownership of this directory to our web server. This will allow the web
server to create files and directories under this directory, which will permit us to upload
content to the server. Proceed like this:
Now we need to copy it to the default configuration file location to get WordPress to
recognize the file. The sample configuration file is available
at/var/www/html/wordpress:
cd /var/www/html/wordpress/
cp wp-config-sample.php wp-config.php
nano wp-config.php
[...]
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpressdb');
nano /var/www/html/wordpress/wp-config.php
/* Multisite */
define('WP_ALLOW_MULTISITE', true);
/* That's all, stop editing! Happy blogging. */
Now we will activate the apache Mod_Rewrite module:
a2enmod rewrite
Now we will change the default virtual host file for Apache as follows:
nano /etc/apache2/sites-enabled/000-default.conf
[...]
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Restart Apache2 to make the services affective:
4 Web installation
Open a browser of your choice and go to the URL http://192.168.0.100/Wordpress:
Select language and press Continue:
Username = admin
Admin password = howtoforge
Confirm Admin Password = howtoforge
The above values will differ in you case, you can give any values of your choice. After
giving the values press Install WordPress:
Give the credentials as you selected at the time of web WordPress installation. This will
be your default welcome window of WordPress.
Add the following to your wp-config.php file in /var/www/html/wordpress/ above the line
reading /* Thats all, stop editing! Happy blogging. */:
nano /var/www/html/wordpress/wp-config.php
Give the entries as per the your output after the multisite installation. In my case it was:
[...]
/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', '192.168.0.100');
define('PATH_CURRENT_SITE', '/wordpress/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy blogging. */
[...]
Note: In my case I am using 192.168.0.100 which will be different in your case
Add the following entries to your .htaccess file in /var/www/html/wordpress/,
replacing other WordPress rules:
nano /var/www/html/wordpress/.htaccess
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
Now relogin to the WordPress. After successfully setting up the Multisite Network, you
need to switch to the Network Dashboard to configure network settings, add new sites,
and do lots of other things. Take your mouse over to My Sites menu in the admin
toolbar, a flydown popup will appear. Click onNetwork Admin-->Dashboard.
Congratulations! You now have a fully functional WordPress 4.0 instance with multiple
site network on your Ubuntu 14.04 :)