Skip to content

Commit

Permalink
Merge pull request #4 from backend-timedoor/develop
Browse files Browse the repository at this point in the history
update readme
  • Loading branch information
yasapurnama committed Mar 18, 2022
2 parents 3891c01 + 9e6cca3 commit 6328c9e
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 3 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
![GitHub all releases](https://img.shields.io/github/downloads/yasapurnama/lemp-laravel/total)
[![GitHub license](https://img.shields.io/github/license/yasapurnama/lemp-laravel)](https://github.com/yasapurnama/lemp-laravel/blob/master/LICENSE)

LEMP Laravel Installer for Ubuntu Server, tested on `Ubuntu 18.04 LTS` and `Ubuntu 20.04 LTS`.
LEMP Laravel is automation bash script to install LEMP Stack (Linux, Nginx, MySQL and PHP).
The script also install essential services that required by Laravel like redis cache and supervisord.
Tested on AWS EC2 `Ubuntu 18.04 LTS` and `Ubuntu 20.04 LTS` server.

**New Update: LEMP Laravel script for Centos see [README_CENTOS.md](README_CENTOS.md)**

![lemp-laravel](https://user-images.githubusercontent.com/12730759/151770303-1ea5e6e9-48e1-4f07-b4ac-ffdd4a1bd588.png)

## Installation
Expand Down
92 changes: 92 additions & 0 deletions README_CENTOS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# LEMP Server Installer for Laravel
![GitHub release (latest by date)](https://img.shields.io/github/v/release/yasapurnama/lemp-laravel)
![GitHub all releases](https://img.shields.io/github/downloads/yasapurnama/lemp-laravel/total)
[![GitHub license](https://img.shields.io/github/license/yasapurnama/lemp-laravel)](https://github.com/yasapurnama/lemp-laravel/blob/master/LICENSE)

LEMP Laravel is automation bash script to install LEMP Stack (Linux, Nginx, MySQL and PHP).
The script also install essential services that required by Laravel like redis cache and supervisord.
Tested on AWS EC2 `Centos 7` server.

![lemp-laravel](https://user-images.githubusercontent.com/12730759/151770303-1ea5e6e9-48e1-4f07-b4ac-ffdd4a1bd588.png)

## Installation

Login as root
```bash
$ sudo su -
```

Install essential tools
```bash
$ yum install screen wget curl vim
```

Create screen session
```bash
$ screen
```

### Quick Installer (Option 1)`
Use quick bash installer with default settings:

```bash
$ curl https://raw.githubusercontent.com/yasapurnama/lemp-laravel/master/lemp-laravel-centos.sh | bash
```

### Manual Install with Custom Variables (Option 2)
```bash
$ wget https://raw.githubusercontent.com/yasapurnama/lemp-laravel/master/lemp-laravel-centos.sh
$ vim lemp-laravel-centos.sh
```

#### Variable Settings
Here are variables that you can change base on your need.

| **Variables** | **Default** | **Note** |
|---------------------------|---------------|---------------------------------------------------------------------------------------------------------------|
| PHP_VERSION | 7.4 | Find LTS support [https://www.php.net/supported-versions.php](https://www.php.net/supported-versions.php) |
| PHPMYADMIN_VERSION | 5.1.1 | Check latest version [https://www.phpmyadmin.net/downloads/](https://www.phpmyadmin.net/downloads/) |
| NVM_VERSION | v0.39.0 | Check latest version [https://github.com/nvm-sh/nvm/releases](https://github.com/nvm-sh/nvm/releases) |
| NODE_VERSION | v16.13.1 | Find LTS support [https://nodejs.org/en/about/releases/](https://nodejs.org/en/about/releases/) |
| NGINX_MAX_BODY_SIZE | 64M | Nginx max body size |
| PHP_MEMORY_LIMIT | 128M | PHP memory limit |
| PHP_UPLOAD_MAX_FILESIZE | 5M | PHP upload max file size |
| PHP_POST_MAX_SIZE | 5M | PHP post max size |
| PHP_MAX_EXECUTION_TIME | 300 | PHP max execution time (in seconds) |
| PHP_MAX_INPUT_TIME | 300 | PHP max input time (in seconds) |
| PHP_MAX_FILE_UPLOAD | 100 | PHP max file upload |
| FPM_MAX_CHILDREN | 50 | PHP FPM max children |
| FPM_START_SERVERS | 20 | PHP FPM start servers |
| FPM_MIN_SPARE_SERVERS | 10 | PHP FPM min spare servers |
| FPM_MAX_SPARE_SERVERS | 20 | PHP FPM max spare servers |
| FPM_MAX_REQUESTS | 500 | PHP FPM max requests |
| REDIS_MAX_MEMORY | 128mb | Redis max memory |

#### Execute the script
```bash
$ chmod +x lemp-laravel-centos.sh
$ ./lemp-laravel-centos.sh
```

### Troubleshoot
If there's `Broken pipe` in ssh connection you can continue the installation.

List screen sessions and find the session id (SID)
```bash
$ screen -ls
```

Restore screen session
```bash
$ screen -r $SID
```

## Contributing
![contributions-wellcome](https://user-images.githubusercontent.com/12730759/150999538-d6872478-96ab-42d6-bb58-0ae443f514c8.svg)

Contributions are always welcome!


## License

Licensed under the MIT License, see [LICENSE](LICENSE) for more information.
4 changes: 2 additions & 2 deletions lemp-laravel-centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ systemctl enable --now supervisord >> ${LOG_FILE} 2>&1
systemctl enable --now redis >> ${LOG_FILE} 2>&1


# Install MySQL
# Install MariaDB
echo -e "${GREEN}[*]${RESET} Install & Configure MySQL.."

yum -y install mysql mariadb-server python-mysqldb >> ${LOG_FILE} 2>&1
Expand Down Expand Up @@ -700,7 +700,7 @@ usermod -aG supervisor root; usermod -aG supervisor ${USERNAME} >> ${LOG_FILE} 2
check_cmd_status "add user to supervisor group.."

chown root:supervisor /var/run/supervisor >> ${LOG_FILE} 2>&1
check_cmd_status "change owner supervisor sock.."
check_cmd_status "change owner supervisor dir.."

sed -i 's/chmod=0700/; allow supervisor group\nchown=root:supervisor\nchmod=0770/g' /etc/supervisord.conf >> ${LOG_FILE} 2>&1
check_cmd_status "edit supervisor config.."
Expand Down

0 comments on commit 6328c9e

Please sign in to comment.