Skip to content

This bash script will install LEMP stack on your server and configure it to maximize its performance.

License

Notifications You must be signed in to change notification settings

rbeat/highload-lemp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Highload LEMP Installation

This bash script will install LEMP stack on your server and configure it to maximize its performance of website serving.

Software

  • NGINX 1.26.1 with fresh ngx-brotli
  • PHP 8.3
  • MariaDB 10.6 (if it ain't broke - don't fix it) w/ MySQLTune
  • OPCache (latest for the selected distro)

Features

  • All-in-one one "click" installation of the LEMP environment
  • NGINX will be installed with the ability to dynamically load or disable any preloaded module
  • Backup will be created for your current NGINX, PHP and MySQL / MariaDB installations
  • Some core settings of NGINX and MariaDB that are often underestimated are configured properly
  • OPcache is enabled and configured for PHP-FPM
  • Monit will be configured to watch after SSH, NGINX, PHP and MySQL / MariaDB and restart them in case of an emergency
  • This configuration was tested in heavy loaded environment (>500k requests to a webserver a day) more then six months straight
  • Don't struggle anymore with adding new server blocks to NGINX when you add new websites to your server

Getting started

Every command is well commented so you will know what happens after each line of the code.

Requirements

  • Check branches to see if your OS is supported
  • This script utilises root user privileges. If you run it from another user you need to add this user to sudoers group and prepend sudo to all commands in the script.

Usage

Select the needed branch for your OS and run the script

LEMP will be configured in such a way that it will try to find a folder which is identical to a website name in your /var/www/ directory.
For example if you created an A-record in your DNS panel where you pointed '@' name of 'test.com' domain to '1.2.3.4' IP adress of your server and you try to access 'test.com' LEMP will try to serve index.php or index.html from the /var/www/test.com directory as an initial response.

MariaDB password is generated using md5 hash of your server hostname and will be put in your /etc/mysql/my.cnf after [client] directive.

Example Files

These files will be created in order to help you understand how this installation works:

  • "Hello World" website in /var/www/test.com
  • phpinfo(); file at /var/www/test.com/info.php
  • opcache.php at /var/www/test.com/opcache.php

Verification

You can verify the installation with the info.php file or using the following commands.
This will show current NGINX version and all installed NGINX modules:

nginx -V

These will show current PHP-FPM version all installed PHP-FPM modules:

php -v
php -m

These will show current MariaDB version and promt EXIT; command if you entered MariaDB shell:

mysql -v
EXIT;
```red MariaDB shell:
```shell
mysql -v
EXIT;

Licensing

The code in this project is licensed under Apache License 2.0

About

This bash script will install LEMP stack on your server and configure it to maximize its performance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%