LEMP

System: Ubuntu 20.04
Edition: 20210804
The image is not available. Choose the latest ones in the same category.

Web server Nginx + PHP + MySQL based on Ubuntu

Description

Ubuntu Linux 20.04.2 updated at 4 august 2021.

Includes:

  • mysql-server 8.0.26-0ubuntu0.20.04.2
  • nginx 1.18.0-0ubuntu1.2
  • php-fpm 2:7.4+75
  • php-mysql 2:7.4+75

Kernel version:

Linux Ubuntu 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Operating system version:

Distributor ID:    Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:    20.04
Codename:    focal
Category:
Base Linux / WEB
Size:
5.00 GB
Image added:
04.08.2021
Image updated:
15.08.2021
Uses:
2

Getting started

Wordpress installation:

  • Execute comand sudo mysql_secure_installation and configure mysql
  • Start mysql promt: sudo mysql
  • Execute this SQL-request to configure database, user, password and priveleges:
CREATE DATABASE wordpress_db; --wordpress_db - название нужной базы данных
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'my_password'; --wordpress_user - Имя пользователя. localhost - Имя хоста. my_password - пароль пользователя.
GRANT ALL PRIVILEGES ON wordpress_db.* to wordpress_user@'localhost'; --Выдаём полные права пользователю wordpress_user на базу данных wordpress_db
FLUSH PRIVILEGES; --Применяем изменения прав
  • Exit from mysql promt: exit
  • Create NGINX config: sudo nano /etc/nginx/sites-available/wordpress with this settings: 
server {
        listen 80;
        listen [::]:80;

        root /var/www/wordpress;

        index index.php;

        server_name localhost;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }
}
  • Save the file with hotkey CTRL+O and exit from editor with hotkey CTRL+X
  • Update NGINX configuration and restart server:
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/wordpress
sudo systemctl restart nginx
  •  Download and unpack Wordpress:
wget -O /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz
sudo tar -xzvf /tmp/wordpress.tar.gz -C /var/www
sudo chown -R www-data.www-data /var/www/wordpress
  • In next step go to your virtual machine ip address in web-browset and configure Wordpress by setting database name (wordpress_db), username (wordpress_user), and user password (my_password).