Shell/Bash: ubuntu lemp Example

By

Shell/Bash Example: This is the "ubuntu lemp" Example. compiled from many sources on the internet by SimpleTutorials.org

ubuntu lemp

// NGINX
sudo apt update
sudo apt install nginx

// MYSQL
sudo apt install mysql-server
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;

exit;
sudo mysql -u root -p

// PHP
sudo apt install php-fpm php-mysql

// Website
sudo mkdir /var/www/your_domain
sudo chown -R $USER:$USER /var/www/your_domain

// Website Configuration
sudo nano /etc/nginx/sites-available/your_domain

server {
    listen 80;
    server_name your_domain www.your_domain;
    root /var/www/your_domain;

    index index.html index.htm index.php;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
     }

    location ~ /\.ht {
        deny all;
    }

}

sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx



// Place your application in your folder
nano /var/www/your_domain/index.html

// Check PHP 
nano /var/www/your_domain/info.php



* Summary: This "ubuntu lemp" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!

Others