GNU/Linux >> Linux Esercitazione >  >> AlmaLinux

Come installare LEMP su Manjaro 20

In questo tutorial, ti mostreremo come installare LEMP su Manjaro 20. Per chi non lo sapesse, LEMP sta per Linux, Nginx (pronunciato come Engine X), MySQL/MariaDB e PHP o Perl o Python. Tutti i componenti sono software gratuiti e open source e la combinazione è adatta per la creazione di pagine Web dinamiche. Lo stack LEMP è una delle configurazioni di server più popolari al mondo.

Questo articolo presuppone che tu abbia almeno una conoscenza di base di Linux, sappia come usare la shell e, soprattutto, che ospiti il ​​tuo sito sul tuo VPS. L'installazione è abbastanza semplice e presuppone che tu sono in esecuzione nell'account root, in caso contrario potrebbe essere necessario aggiungere 'sudo ' ai comandi per ottenere i privilegi di root. Ti mostrerò passo dopo passo l'installazione di LAMP Stack su un Manjaro 20 (Nibia).

Installa LEMP su Manjaro 20 Nibia

Passaggio 1. Prima di eseguire il tutorial di seguito, assicurati che il nostro sistema sia aggiornato:

sudo pacman -Syu

Passaggio 2. Installazione di Nginx.

Installa Nginx su Manjaro Linux eseguendo il comando seguente:

sudo pacman -S nginx

Una volta installato Nginx, avvialo e abilitalo all'avvio all'avvio del sistema:

sudo systemctl start nginx
sudo systemctl enable nginx

Per verificare la configurazione di Nginx, apri il browser e vai al nome host del server o all'indirizzo IP e dovresti vedere la pagina di test predefinita di Nginx come mostrato di seguito:

http://your-ip-address

Passaggio 3. Installa MariaDB.

Esegui il seguente comando per installare MariaDB Server su Manjaro:

sudo pacman -S mariadb

Quindi, inizializza la directory dei dati di MariaDB e crea le tabelle di sistema come mostrato di seguito:

sudo mysql_install_db –user=mysql basedir=/usr –datadir=/var/lib/mysql

Successivamente, abilitalo e avvialo usando i seguenti comandi:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Per impostazione predefinita, MariaDB non è protetto. Puoi proteggere MySQL usando mysql_secure_installation sceneggiatura. dovresti leggere attentamente e sotto ogni passaggio che imposterà una password di root, rimuoverà gli utenti anonimi, non consentirà l'accesso root remoto e rimuoverà il database di test e l'accesso per proteggere MariaDB:

$ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Passaggio 4. Installazione di PHP.

Esegui il seguente comando per installare PHP:

sudo pacman -S php php-fpm

Una volta completata l'installazione, avvia e abilita php-fpm per iniziare all'avvio con i seguenti comandi:

sudo systemctl start php-fpm
sudo systemctl enable php-fpm

Dobbiamo apportare alcune modifiche al file di configurazione di Nginx:

sudo nano /etc/nginx/nginx.conf

Aggiungi le seguenti righe:

location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
root /usr/share/nginx/html;
include fastcgi.conf;
}

Salva il file e riavvia sia Nginx che PHP-FPM per rendere effettive le modifiche:

sudo systemctl restart nginx
sudo systemctl restart php-fpm

Per testare l'installazione di PHP, creare un info.php file nel /usr/share/nginx/html/ percorso:

sudo nano /usr/share/nginx/html/info.php

Aggiungi le seguenti righe e salva il file:

<?php
phpinfo();
?>

Passaggio 5. Configura il firewall.

Per consentire connessioni esterne al nostro server Web Manjaro Linux, dobbiamo aprire le porte Web 80 e 443. Ma prima, installiamo ufw un firewall:

sudo pacman -S ufw
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

Congratulazioni! Hai installato correttamente il server LEMP. Grazie per aver utilizzato questo tutorial per l'installazione di LEMP (Nginx, MariaDB e PHP) nei sistemi Manjaro 20. Per ulteriore aiuto o informazioni utili, ti consigliamo per controllare i siti Web ufficiali di Nginx, MariaDB e PHP.


AlmaLinux
  1. Come installare MariaDB su Debian 10

  2. Come installare BoxBilling su Debian 11

  3. Come installare MariaDB su Arch Linux / Manjaro Linux

  4. Come installare MariaDB su CentOS 7 / RHEL 7

  5. Come installare MariaDB su Ubuntu 16.04

Come installare MariaDB su Manjaro 21

Come installare SuiteCRM su Debian 11

Come installare MariaDB su CentOS 6

Come installare MariaDB su CentOS 7

Come installare MariaDB su Ubuntu 14.04

Come installare MariaDB su Ubuntu 18.04 LTS