Git Product home page Git Product logo

highload-lemp's Introduction

Highload LEMP Installation

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

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

  • Ubuntu 16.04 or later (best if it's fresh / clean installation)
  • 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

To download and run this script in a single command use the line below:

wget https://raw.githubusercontent.com/sutlxwhx/Highload-LEMP-Installation/master/install.sh && bash install.sh

Or download install.sh manually, make it executable and run it:

wget https://raw.githubusercontent.com/sutlxwhx/Highload-LEMP-Installation/master/install.sh
chmod +x install.sh
./install.sh

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;

Contributing

Please, feel free to fork this repository and add support for your OS. It will greatly help developers who prefer another OS. I' am not doing this myself because I found that using prebuilt packages from Ubuntu repository makes usage of this script endlessly faster with less headache then trying to define why Nginx package is not compiling from the source code on this or that particular OS.

Licensing

The code in this project is licensed under Apache License 2.0

highload-lemp's People

Contributors

sutlxwhx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.