Knowledge Base

How do I install a LAMP or LEMP stack on the server?

How do I install a LAMP or LEMP stack on the server?

LAMP (Linux, Apache, MySQL, PHP): ```bash sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql ``` Configure MySQL root password and create a database as needed: ```pgsql sudo mysql_secure_installation CREATE DATABASE my_database; GRANT ALL PRIVILEGES ON my_database.* TO 'user'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; ``` Restart Apache: sudo systemctl restart apache2. LEMP (Linux, Nginx, MySQL, PHP): ```bash sudo apt install nginx mysql-server php-fpm php-mysql ``` Configure MySQL as above: ```pgsql sudo mysql_secure_installation CREATE DATABASE my_database; GRANT ALL PRIVILEGES ON my_database.* TO 'user'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; ``` Create an Nginx virtual host file under /etc/nginx/sites-available/example.com: ```nginx server { listen 80; server_name example.com www.example.com; root /var/www/example.com; index index.php index.html; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.4-fpm.sock; } } ``` Enable the site: ```swift sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/ sudo systemctl restart nginx ```

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?

2 times viewed | 0 people fount it helpful

3826704865 +38267054865 +38267054865 Top