Created
December 2, 2020 16:59
-
-
Save ThinkLikeLinux/c1149f6fb356e211d7bef7ba984966bd to your computer and use it in GitHub Desktop.
LEMP Install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you need LEMP installation, contact with me: | |
Telegram:@ThinkLikeLinux | |
email:[email protected] | |
WhatsApp:+8801309824364 | |
Skype:live:.cid.bd73b6d4d960b474 | |
#==========================================================# | |
#!/bin/sh | |
Install Nginx Web Server | |
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove | |
sudo apt update | |
sudo apt install nginx | |
sudo systemctl stop nginx.service | |
sudo systemctl start nginx.service | |
sudo systemctl enable nginx.service | |
Install MariaDB Database Server | |
sudo apt-get install mariadb-server mariadb-client | |
sudo apt-get install mariadb-server | |
sudo apt-get install mariadb-client | |
sudo systemctl stop mariadb.service | |
sudo systemctl start mariadb.service | |
sudo systemctl enable mariadb.service | |
After that, run the commands below to secure MariaDB server by creating a root password and disallowing remote root access. | |
sudo mysql_secure_installation | |
To test if MariaDB is installed, type the commands below to logon to MariaDB server | |
sudo mysql -u root -p | |
Install PHP-FPM and Related Modules | |
sudo apt install php-fpm php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-zip php-curl | |
php -v | |
sudo nano /etc/php/7.2/fpm/php.ini | |
sudo systemctl restart nginx.service | |
sudo nano /etc/nginx/sites-available/default | |
sudo systemctl restart nginx.service | |
sudo nano /etc/nginx/sites-available/default | |
and make below changes | |
file_uploads = On | |
allow_url_fopen = On | |
memory_limit = 256M | |
upload_max_filesize = 100M | |
max_execution_time = 360 | |
date.timezone = America/Chicago | |
sudo nano /var/www/html/phpinfo.php | |
If you have a custom file, then edit it to enable Nginx PHP support. Run the commands below to open Nginx default site configuration file | |
sudo nano /etc/nginx/sites-available/default | |
Then make uncomment the highlighted lines below to enable Nginx PHP support. | |
server { | |
listen 80; | |
listen [::]:80; | |
root /var/www/html; | |
index index.php index.html index.htm; | |
server_name localhost; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; | |
} | |
} | |
sudo nginx -t | |
cd /etc/nginx/sites-available/ | |
ls | |
sudo nano default | |
sudo systemctl restart nginx.service | |
sudo systemctl status nginx.service | |
At this point, Nginx and PHP-FPM should be installed and ready.. to test your Nginx PHP settings, create a blank file with the line below: | |
sudo nano /etc/nginx/sites-available/default | |
Then add the line in the file and save. | |
<?php phpinfo( ); ?> | |
sudo systemctl restart nginx.service | |
ls | |
cd /run/php/ | |
ls | |
sudo nano /etc/nginx/sites-available/default | |
sudo systemctl restart nginx.service | |
ls | |
sudo nano /etc/nginx/sites-available/default | |
sudo systemctl restart nginx.service | |
http://localhost/phpinfo.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment