Skip to content
Rashid Azar

Install WordPress on Nginx Server

Linux, PHP1 min read

Download latest wordpress code:

1$ wget https://wordpress.org/latest.tar.gz

Extract files:

1$ tar xvzf latest.tar.gz

Copy all extracted files to /var/www/html folder:

1$ sudo cp -R wordpress/ /var/www/html/mysite.com

Change directory to /var/www/html folder:

1$ cd /var/www/html/

Change group and owner of all files to www-data:

1$ sudo chown -R www-data:www-data /var/www/html/mysite.com

Create MySQL user for mysite.com:

1$ mysql -u root -p
2
3use mysql;
4CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mystrongpassword!';
5CREATE DATABASE mysite;
6grant all privileges on mysite.* to 'myuser'@'localhost' identified by "mystrongpassword";
7FLUSH PRIVILEGES;
8exit;

Create wp-config.php file and update as per above details.

To create a virtual host please follow this post

© 2021 by Rashid Azar. All rights reserved.