WordPress is an excellent platform for running your blog. Debian 9 with LEMP is an excellent backend to run WordPress on, combining the reliability of the LEMP stack with WordPress’s feature set.
While not as common as the LAMP stack, LEMP is often a superior backend for high volume WordPress sites due to the Nginx web server’s performance in high load situations.
Install LEMP
Update the System and Install CURL
$ sudo apt-get update && sudo apt-getinstall$ sudo apt-get install curl
Install NGINX
$ sudo apt install nginx
Install MySQL
$ sudo apt install mysql-server $ sudo mysql_secure_installation
Install PHP Extensions
$ sudo apt install php-fpm php-mysql php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip $ sudo systemctl restart php-fpm
Configure Nginx to use the PHP Processor
Create a Root Directory For Your Domain
$ sudo mkdir /var/www/yourdomain.com
Create a Configuration File
$ sudo nano /etc/nginx/sites-available/yourdomain.com
Add the following to the file:
server { listen80; listen [::]:80; root /var/www/yourdomain; index index.php index.html index.htm; server_name yourdomain; location / { #try_files $uri $uri/ =404; try_files$uri$uri/ /index.php$is_args$args; } location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; } location = /favicon.ico { log_not_foundoff; access_logoff; } location = /robots.txt { log_not_foundoff; access_logoff; allow all; } location ~* .(css|gif|ico|jpeg|jpg|js|png)$ { expires max; log_not_foundoff; } }
Symlink the Config Files From Nginx’s sites-available Directory
$ sudo ln -s /etc/nginx/sites-available/yourdomain.conf /etc/nginx/sites-enabled/
Restart Nginx
$ sudo systemctl reload nginx
Configure MySQL
Add a MySQL User
$ sudo mysql -u root -p > CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Set the User Rights
> GRANT ALL ON wordpress.* TO 'databaseuser'@'localhost' IDENTIFIED BY 'password'; > Flush Privileges; > Exit;
Download and Configure WordPress
Download the File to a Writable Directory
$ cd /tmp $ curl -LO https://wordpress.org/latest.tar.gz
Extract the File
$ tar xzvf latest.tar.gz
Create a Config File From the Sample WordPress Config File
$ cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
Copy the WordPress Files Over to the Web Document Root Directory
$ sudo cp -a /tmp/wordpress/. /var/www/yourdomain.com
Assign Ownership of the Files
$ sudo chown -R www-data:www-data /var/www/yourdomain.com
Generate Secret Key Values
$ curl -s https://api.wordpress.org/secret-key/1.1/salt/
Copy the Secret Keys into the WordPress Configuration File
$ sudo nano /var/www/yourdomain/wp-config.php
You will find a section in the file that looks like this:
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');
Replace this with the output from the command run in step 6.
Update the Database Information in the WordPress Configuration File
In the WordPress Configuration File find the lines
define('DB_NAME', 'wordpressdatabasename'); define('DB_USER', 'wordpressuser'); define('DB_PASSWORD', 'password');
Update these lines with the values used when you created your database. Add the line below as well and then save and close the file.
define('FS_METHOD', 'direct');
Finish the Install from the UI
Select the Language
Provide Some Basic Site Information and Setup the Admin Account
You Will See a Confirmation Screen
Login and You Can Begin Setting Up Your Site!
Now that you’ve logged in take a few minutes to look over the navigation menu on the left hand side. You can access all of the major features of WordPress including theme selection, plugins, and user setup from here. WordPress is a powerful CRM and now that you have it up and running, you should be able to get your site up and running in no time at all.
Check out these top 3 WordPress hosting services:
- Know about the best wordpress web hosting by clicking here.