The LEMP stack consists of software used to create web servers: Linux, Nginx, MySQL, PHP. Unlike the popular LAMP stack (Linux, Apache, MySQL, PHP), Nginx is used instead of Apache. Nginx provides stable operation under high loads.
Installation package information
Beget VPS with pre-installed LEMP is a ready-to-use web server software with no separate installation or configuration required.
The LEMP stack architecture is popular among all those who administer their own server.
Beget LAMP preinstalled VPS is based on the latest available versions from the repository:
- Ubuntu 24.04
- MySQL 8.0.41
- Nginx 1.24.0
- PHP 8.4 (php-fpm)
Nginx is a web server capable of handling a large number of requests for static content (pictures, text, etc). It is used to display the site.
MySQL is a database management system. It is based on the client-server architecture. The client (the user's computer) sends a request, and the database server processes it and sends a response. MySQL database stores information about the site.
PHP-FPM is a service that handles PHP code. Nginx has no built-in support for PHP like some other web servers. PHP is needed to generate dynamic content.
- php-cli – command line tools for executing PHP scripts
- php-fpm – library for linking Nginx and PHP via FastCGI. It allows PHP code execution for the site
- php-curl – library that allows getting and sending data via HTTP, FTP, HTTPS
- php-gd – library for working with graphics
- php-intl – allows performing locale-dependent operations. For example, formatting, transliteration, encodings, calendar operations, etc.
- php-mbstring – supports extended character encoding
- php-mysql – provides interaction with MySQL
- php-soap – supports the SOAP protocol for exchanging messages
- php-xml – supports XML
- php-xmlrpc – supports XML-RPC
- php-zip – supports ZIP archives
Working with LEMP web server stack
You can install the software from the Beget control panel with one click. Before installation, you can select the server configuration and configure the SSH connection method – add an SSH key, and/or generate a password to connect via SSH. If you don't set the authentication method, the password will be generated automatically and sent to email.
You can connect to a deployed server by using the terminal (bash, Putty) command ssh root@ip_server. The IP address of the server can be found in the control panel of the deployed server. If you hover your cursor over it, you can see the full command to connect. The password for the connection has been set or received earlier. No other additional action is required.
When you create a server, basic configuration parameters will be emailed to you:
- By default, one virtual host is created. It is available at
http://ip_server - The directory with files for the virtual host is located in
/var/www/html. For LEMP security reasons we recommend that you set the file access rights to755, and designatewww-dataas the owner - Password for the MySQL
rootuser is in/root/.my.cnf
You can change any settings of your web server or MySQL by yourself.
FAQ
The default virtual host configuration file is located in the file:/etc/nginx/sites-enabled/default
PHP-FPM configuration files are located at: /etc/php/8.1/fpm
PHP interpreter configuration file: /etc/php/8.1/fpm/php.ini
- Connect to MySQL with
sudo mysql -uroot - After that, create a new user:
CREATE USER 'user-name'@'localhost' IDENTIFIED BY 'password' - Give the new user all access rights:
GRANT ALL PRIVILEGES ON * . * TO 'user-name'@'localhost' - For the changes to take effect, run the command:
FLUSH PRIVILEGES/
Use the commands to restart services:
- Nginx:
systemctl restart nginx - MySQL:
systemctl restart mysql.service - PHP-FPM:
systemctl restart php8.1-fpm.service
