Tech

Steps to create your Own website Using WordPress

Lot of us think about creating our own website, create our own blog, but maybe sometime we lack technical skill to create a website. WordPress is one of the tool that facilitates us to create/design website without having much technical knowledge. So lets see steps to create your own website using wordpress. 

Prerequisite for this tutorial:
  •  We need Ubuntu machine. Follow this link to get free ubuntu machine.
  • User should have sudo rights. 
  • LEMP Stack should be installed. Follow this link for installation of LEMP stack.
Step 1: Installing Additional PHP Extensions

WordPress needs some additional PHP extensions, lets install those.

$ sudo apt update
$ sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip

Now, we will restart the PHP-FPM process so that the running PHP processor can leverage the newly installed features:

$ sudo systemctl restart php7.4-fpm
Step 2: Nginx configuration for WordPress

We already have seen nginx basic configuration in this blog. Here we will add some location block inside main server block. Lets say our domain name is elitetribune.com 

/etc/nginx/sites-available/elitetribune.com

server {
    . . .
    location / {
        #try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php$is_args$args;
    }
location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; allow all; } location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ { expires max; log_not_found off; } . . . }

This is just basic configuration, but as we will making this website live, we need to make it more secure. To make it more secure we can so nginx hardening.  There are many blogs to which guides us about hardening nginx for wordpress like below:

Let me know on comment if you want me to share link of my hardened nginx configuration.
Step 3: Downloading WordPress

Lets download wordpress tar package from wordpress.org

We will run below sets of command one by one.

Lets change directory to /tmp where we will download package
$ cd /tmp

Enter following curl command to download the latest version of WordPress:
$ curl -LO https://wordpress.org/latest.tar.gz

Extract the compressed file:
$ tar xzvf latest.tar.gz

Copy sample configuration file to the filename that WordPress actually reads: $ cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php Now, let’s copy the entire contents of the directory into our document root. We’re using the -a flag to make sure our permissions are maintained, and a dot at the end of our source directory to indicate that everything within the directory should be copied (including hidden files): $ sudo cp -a /tmp/wordpress/. /var/www/elitetribune.com Assign ownership to the www-data user and group. This is the user and group that Nginx runs as, and Nginx will need to be able to read and write WordPress files in order to serve the website and perform automatic updates: $ sudo chown -R www-data:www-data /var/www/elitetribune.com

 

Step 4: Setting up the WordPress Configuration File

We will adjust some secret keys to provide some security for our installation. WordPress provides a secure generator for these values so that you don’t have to come up with values on your own. 

To generate secure values from WordPress secret key generator, run below command:

$ curl -s https://api.wordpress.org/secret-key/1.1/salt/

Output will be displayed something like below:

Output
define('AUTH_KEY',         '<secret-generated-key>');
define('SECURE_AUTH_KEY',  '<secret-generated-key>');
define('LOGGED_IN_KEY',    '<secret-generated-key>');
define('NONCE_KEY',        '<secret-generated-key>');
define('AUTH_SALT',        '<secret-generated-key>');
define('SECURE_AUTH_SALT', '<secret-generated-key>');
define('LOGGED_IN_SALT',   '<secret-generated-key>');
define('NONCE_SALT',       '<secret-generated-key>');

Copy these output and paste to your config file:

$ sudo nano /var/www/wordpress/wp-config.php

Find the section that contains the dummy values for those settings. It will look something like this:

/var/www/wordpress/wp-config.php

. . .

define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

. . .

Delete those lines and paste in the values you copied from the command line:

Now in same configuration file, we will modify database connection settings and set the filesystem method to “direct”.

/var/www/wordpress/wp-config.php

. . .

define( 'DB_NAME', 'wordpress' );

/** MySQL database username */
define( 'DB_USER', 'wordpressuser' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password' );

. . .

define( 'FS_METHOD', 'direct' );
. . .

Save and close the file now.

 

Step 5: Completing the Installation Through the Web Interface

Now that the server configuration is complete,  we can finish up the installation through WordPress’ web interface.

In your web browser, navigate to your server’s domain name or public IP address:

https://server_domain_or_IP/wordpress

and complete rest of the configuration.

Hurrah, we have our own website now. 

Thank you everyone. Please let us know if you guys have any query.

Elite Tribune

One thought on “Steps to create your Own website Using WordPress

  • Aw, this was a very nice post. In concept I want to put in writing like this moreover ?taking time and actual effort to make a very good article?however what can I say?I procrastinate alot and certainly not seem to get something done.

    Reply

Leave a Reply

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