How to create website or blog using WordPress

For the question – how to create website or blog, the best answer would be WordPress.

Describing WordPress – it is a free open source website creation tool written in PHP. It is content management system (CMS) based on PHPP and MySQL. WordPress is installed on a machine/web-server that is either part of an Internet hosting service or a network host.

Here we will list the steps to install WordPress in Ubuntu 14.04 server, we will also go through basic set up of WordPress website.

You can get access to a Ubuntu 14.04 machine by following below tutorial on google cloud set up and creating machine/instance from google cloud.

— Google Cloud set-up

— Create Instance / Machine in Google Cloud Platform (GCP)

Once machine is ready, follow below steps to setup WordPress.

 

-Install Updates :

sudo apt-get update Run this command to install the latest updates. It is advisable to run this before installing any package

 

-Install MySQL :

sudo apt-get install mysql-server
sudo mysql_install_db

sudo mysql_secure_installation (It is recommended that except for question “Change the root password”, you answer yes to these options )

 

-Configure MySQL :

mysql -u root -p
mysql> CREATE DATABASE mywordpress;
mysql> CREATE USER myadmin@localhost IDENTIFIED BY 'mypassword';
mysql> GRANT ALL PRIVILEGES ON mywordpress.* TO myadmin@localhost;
mysql> FLUSH PRIVILEGES;
mysql> Exit

 

-Install PHP

sudo apt-get install php5-fpm php5-mysql

sudo vi /etc/php5/fpm/php.ini Open “php.ini” file and search for text “cgi.fix_pathinfo”. This will be commented out with a semi-colon (;) and set to “1” by default. We need to change both of these conditions by uncommenting the line and setting it to “0” like this:  cgi.fix_pathinfo=0

 

-Download wordpress and Configure it

cd ~
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo apt-get install php5-gd libssh2-php
cd wordpress/
cp wp-config-sample.php wp-config.php

vim wp-config.php  ( We need to edit this file and update  parameters related to  DB_NAME, DB_USER, and DB_PASSWORD.)

 

Before editing wp-config.php file, it will be as shown in below snapshot :

 

You need to update  DB_NAME, DB_USER, and DB_PASSWORD parameters in this file, updated file will look as below :

Once wp-config.php file is update, we need to move wordpress content to /var/www/html , use below command for the same :
sudo mkdir -p /var/www/html
sudo cp -r /home/techiematerials/wordpress/* /var/www/html/
sudo chmod -R 755 /var/www/html/*

 

-Install Nginx

sudo apt-get install nginx

sudo vim /etc/nginx/sites-available/default

Open the nginx “default” file and delete its content and copy below content, as these settings are required to run wordpress on nginx.

$ cat /etc/nginx/sites-available/default

server {

listen 80 default_server;

listen [::]:80 default_server ipv6only=on;

root /var/www/html;

index index.php index.html index.htm;

location / {

# try_files $uri $uri/ =404;

try_files $uri $uri/ /index.php?q=$uri&$args;

}

error_page 404 /404.html;

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html;

}

location ~ \.php$ {

try_files $uri =404;

fastcgi_split_path_info ^(.+\.php)(/.+)$;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

}

Once nginx default file is updated, we need to restart nginx and php services. Below commands are used for it.

sudo service nginx restart
sudo service php5-fpm restart

 

Then hit URL :      http://IP_addr   in our case is http://35.185.174.26

You will find below Welcome page. Update the file accordingly. (Make sure to save this password as you will need it to login to WordPress dashboard)

 

 

Once above information is provided and you have clicked on button “install WordPress”,

Login to its admin view using URL :    http://IP_Addr/wp-login.php   in our case it is :

http://35.185.174.26/wp-login.php

 

 

Once logged in you will find below WordPress dashboard:

Also hit url :    http://IP_Addr  , to see front view of your wordpress website.

 

It’s all done, your wordpress website is up and running.

One thought on “How to create website or blog using WordPress”

Leave a Reply

Your email address will not be published. Required fields are marked *