Install WordPress On Ubuntu 18.04 Nginx


Install WordPress On Ubuntu 18.04 Nginx

Introduction To Ubuntu And Nginx

Ubuntu is a popular open-source operating system which has gained immense popularity over the years. It is easy to use and relatively secure and stable. Nginx is a popular web server which is known for its speed and scalability. It is used to serve websites and can be deployed on Ubuntu.

Prerequisites for Installing WordPress On Ubuntu

Before you install WordPress on Ubuntu, there are some prerequisites that need to be met. First, make sure that you have a functioning Ubuntu system with root or privileged user access. Next, you need to have a domain name and a DNS record for the domain. Lastly, you need to have an SSH key to access the server securely.

How To Install Nginx On Ubuntu

Once you have complied with the prerequisites, you can begin the process of installing Nginx on Ubuntu. The first step is to install Nginx itself. This can be done by running the following command in the terminal:


$ sudo apt-get install nginx

Once the installation has finished, you should be able to view the Nginx welcome page by going to http://yourdomain.com. If you can see the welcome page, that means Nginx is installed and running.

Configure Nginx On Ubuntu

Now that Nginx is installed, it is time to configure it for use with WordPress. You will need to edit the main configuration file for Nginx located at /etc/nginx/nginx.conf. In this file, you need to remove the default server block and replace it with the following:


server {
listen 80;
listen [::]:80;

root /var/www/html/wordpress;
index index.php index.html index.htm;

server_name example.com www.example.com;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}

location ~ /.ht {
deny all;
}
}

Once you have saved the file, you need to restart Nginx for the changes to take effect. This can be done with the following command:


$ sudo systemctl restart nginx

Install MySQL On Ubuntu

Now that Nginx is up and running, the next step is to install MySQL. First, you need to install the MySQL server package and the MySQL client package. This can be done by running the following command in the terminal:


$ sudo apt-get install mysql-server mysql-client

Once the installation has finished, you need to secure the MySQL installation. This is done by running the mysql_secure_installation script which can be found in /usr/bin/mysql_secure_installation. The script will prompt you to enter a root password and other security related questions.

Installation Of WordPress On Ubuntu

Once MySQL is installed and secured, you can start the installation of WordPress. The first step is to download the latest version of WordPress from the WordPress website. After downloading it, extract the archive to the /var/www/html/wordpress directory. This can be done with the following commands:


$ cd /var/www/html
$ tar -xf wordpress-x.x.x.tar.gz

Once WordPress is extracted, you need to create a database and a user for WordPress. This is done with the MySQL commands, CREATE DATABASE and GRANT ALL PRIVILEGES. After creating the database and user, you need to edit the wp-config.php file located in the /var/www/html/wordpress directory. In this file, you need to add the database name, username, and password.

The last step is to install the theme and plugins. This is done by going to the WordPress dashboard and navigating to the Appearance and Plugins menus. From there, you can browse and install the themes and plugins of your choice.

Conclusion

In this tutorial, we have shown you how to install WordPress on Ubuntu 18.04 Nginx. We have also covered how to configure Nginx and MySQL as well as how to install themes and plugins. If you have any questions or feedback, feel free to leave a comment below. Thank you for reading this article! Please read other articles.

Leave a Reply

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