Setup WordPress Multisite on Ubuntu 14.04.4 with Nigx
Setup WordPress Multisite on Ubuntu 14.04.4 with Nigx. In this
tutorial you will learn how to install wordpress with Nigx on Ubuntu
14.04.4 server with Multisite enabled.
What we need:
You will be asked to enter password for SQL
Create folder where you will save WordPress files
Remove symlink in the site-enabled directory
Create virtual host file inside site-available
Paste this code:
Save this file by pressing ctrl+o and exit ctrl+x
Create a symlink of this file inside site-enabled directory
Test your Nginx configuration and restart
Create a database. In this tutorial we will create new user – user: demo password: yourpassword
Extract the file
Move the extracted files into Nginx directory
Assign ownership
You’ll be directed to a welcome page. Fill up the page and click Install WordPress
Select your language
Here you need to enter you WordPress setup
Click Run the Install
Enter the details of your website, you username and password that will be used to login to your WordPress
Click Install WordPress
On your Putty again, type this:
Find this line “/* That’s all, stop editing! Happy blogging. */” at the bottom. Below this line, paste the following codes:
Go to your WordPress on browser and click Tools >> Network Setup. Please look at the picture below. We will copy these codes inside the blue box and green box and we will paste this in our server using Putty.
Now we need to go to Putty again and open the WordPress setting file
Find this line again (/* That’s all, stop editing! Happy blogging. */) Below this line we will paste the code from the web browser. Go back to you web browser and copy the codes inside the blue box (See picture above) and paste it to Putty.
Remember to change the SUBDOMAIN_INSTALL value to true
Save the file (ctrl+o) and exit (ctrl+x)
Next is to edit .htaccess
Paste it to you Putty. Save the .htaccess file (ctrl+o) and exit (ctrl+x)
Let’s edit the WordPress configuration again:
Find /* That’s all, stop editing! Happy blogging. */ and below this line, add the following code:
ACTIVATING THE PLUGINS
On your web browser, click the My Sites >> Network Admin >> Plugins
Go to Settings >> Domain Mapping and make changes to the Domain Options:
On you Putty
Paste this code:
Save the file (ctrl+o) and exit (ctrl+x)
Congratulation, you have a WordPress Multi-site
What we need:
- Ubuntu Server 14.04.4
- Putty software
- Root access
Install and configure Nginx, MySql and PHP
apt-get update
apt-get install -y nginx mysql-server php5-fpm php5-mysql php5-curl php5-mcrypt php5-gd
You will be asked to enter password for SQL
Create folder where you will save WordPress files
mkdir /usr/share/nginx/wordpress
Remove symlink in the site-enabled directory
rm /etc/nginx/sites-enabled/default
Create virtual host file inside site-available
nano /etc/nginx/sites-available/mywp
Paste this code:
server {
listen [::]:80 ipv6only=off;
server_name example.com *.example.com myshop.com;
root /usr/share/nginx/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args ;
}
location ~ /favicon.ico {
access_log off;
log_not_found off;
}
location ~ \.php$ {
try_files $uri /index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/wpms-error.log;
}
Save this file by pressing ctrl+o and exit ctrl+x
Create a symlink of this file inside site-enabled directory
ln -s /etc/nginx/sites-available/mywp /etc/nginx/sites-enabled/mywp
Test your Nginx configuration and restart
service nginx configtest
service nginx restart
Create your MySQL Database and add a WordPress User
Login to the MySQL command linemysql -u root -p
Create a database. In this tutorial we will create new user – user: demo password: yourpassword
and grant permission to the databaseCREATE DATABASE wordpress;
CREATE USER 'demo'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON wordpress.* TO 'demo'@'localhost';
FLUSH PRIVILEGES;
exit
Installing WordPress
Download WordPresswget http://wordpress.org/latest.tar.gz
Extract the file
tar -xf latest.tar.gz
Move the extracted files into Nginx directory
mv wordpress/* /usr/share/nginx/wordpress/
Assign ownership
chown -R www-data:www-data /usr/share/nginx/wordpress
Now go to your internet browser and open your website address (example.com).You’ll be directed to a welcome page. Fill up the page and click Install WordPress
Select your language
Click Let’s go!
Database Name: wordpress
Username: demo
Password: yourpassword
Database host: localhost
Table Prefix: wp_
**Click Submit button
Click Run the Install
Enter the details of your website, you username and password that will be used to login to your WordPress
Click Install WordPress
Enable the WordPress Multi-site
This will allow you to have more than one website in a single WordPress. To make this happen, we have to enable the Multi-site function of the WordPress. Let’s start configuring the WordPress settings.On your Putty again, type this:
nano /usr/share/nginx/wordpress/wp-config.php
Find this line “/* That’s all, stop editing! Happy blogging. */” at the bottom. Below this line, paste the following codes:
/* Multisite settings */
define( 'WP_ALLOW_MULTISITE', true );
#Save the file by pressing ctrl+o and exit ctrl+xGo to your WordPress on browser and click Tools >> Network Setup. Please look at the picture below. We will copy these codes inside the blue box and green box and we will paste this in our server using Putty.
Now we need to go to Putty again and open the WordPress setting file
nano /usr/share/nginx/wordpress/wp-config.php
Find this line again (/* That’s all, stop editing! Happy blogging. */) Below this line we will paste the code from the web browser. Go back to you web browser and copy the codes inside the blue box (See picture above) and paste it to Putty.
Remember to change the SUBDOMAIN_INSTALL value to true
Save the file (ctrl+o) and exit (ctrl+x)
Next is to edit .htaccess
nano /usr/share/nginx/wordpress/.htaccess
On the web browser, copy the codes inside the green box shown in the picture below:Paste it to you Putty. Save the .htaccess file (ctrl+o) and exit (ctrl+x)
Adding Domain Mapping Plugin manually
We have to download the plugin file and install it manually. On your Putty, enter this code one by one:wget http://downloads.wordpress.org/plugin/wordpress-mu-domain-mapping.latest-stable.zip
apt-get install unzip
unzip wordpress-mu-domain-mapping.latest-stable.zip
mv wordpress-mu-domain-mapping /usr/share/nginx/wordpress/wp-content/plugins/
cp /usr/share/nginx/wordpress/wp-content/plugins/wordpress-mu-domain-mapping/sunrise.php /usr/share/nginx/wordpress/wp-content/
Let’s edit the WordPress configuration again:
nano /usr/share/nginx/wordpress/wp-config.php
Find /* That’s all, stop editing! Happy blogging. */ and below this line, add the following code:
define('SUNRISE', 'on');
ACTIVATING THE PLUGINS
On your web browser, click the My Sites >> Network Admin >> Plugins
Find WordPress MU Domain Mapping and click Network Activate
On you Putty
mkdir /usr/share/nginx/wordpress/wp-content/mu-plugins
nano /usr/share/nginx/wordpress/wp-content/mu-plugins/wpms_blogid.php
Paste this code:
<?php
add_filter( 'wpmu_blogs_columns', 'do_get_id' );
add_action( 'manage_sites_custom_column', 'do_add_columns', 10, 2 );
add_action( 'manage_blogs_custom_column', 'do_add_columns', 10, 2 );
function do_add_columns( $column_name, $blog_id ) {
if ( 'blog_id' === $column_name )
echo $blog_id;
return $column_name;
}
function do_get_id( $columns ) {
$columns['blog_id'] = 'ID';
return $columns;
}
Save the file (ctrl+o) and exit (ctrl+x)
Congratulation, you have a WordPress Multi-site
0 comments: