GNU/Linux >> Linux Esercitazione >  >> Linux

Installa Apache su Debian 10

Questo articolo spiega come installare Apache® su un server Debian® 10.

Cos'è Apache?

Apache è un server Web multipiattaforma open source che Apache SoftwareFoundation gestisce attivamente.

Prerequisiti

  • Utente con sudo privilegi
  • Server che esegue Debian 10
  • Firewall Firewall (UFW) semplice

Fase 1:aggiorna e installa Apache

Eseguire il comando seguente per aprire il terminale e aggiornare il repository:

`# sudo apt update`

Quindi, installa il pacchetto apache:

`# sudo apt install apache2`

Fase 2:verifica l'installazione

Esegui il seguente comando:

`# sudo systemctl status apache2`

Notare il attivo (in esecuzione) messaggio nella seguente risposta:

    ● apache2.service - The Apache HTTP Server
       Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
       Active: active (running) since Thu 2021-03-11 09:56:58 CST; 1 weeks 0 days ago
         Docs: https://httpd.apache.org/docs/2.4/
      Process: 2141 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
     Main PID: 6087 (apache2)
        Tasks: 55 (limit: 1158)
       Memory: 10.4M
       CGroup: /system.slice/apache2.service
               ├─2147 /usr/sbin/apache2 -k start
               ├─2148 /usr/sbin/apache2 -k start
               └─6087 /usr/sbin/apache2 -k start

    Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

Fase 3:accedi ad Apache

Per accedere al server, devi conoscere l'indirizzo IP, quindi esegui il seguente comando per trovare l'indirizzo IP:

`# hostname -I`

Se digiti l'indirizzo IP nel tuo browser, viene visualizzato un errore durante il caricamento della pagina. Questo errore si verifica perché non hai ancora aggiunto la regola HTTP al firewall.

Passaggio 4. Aggiungi regole firewall

Esegui i seguenti comandi per aggiungere la regola WWW al firewall e consentire il traffico in entrata e in uscita:

`sudo ufw allow 'WWW'`
`sudo ufw status  | grep 80/tcp`

L'esempio seguente mostra le regole del firewall sul server:

    80/tcp                     ALLOW       Anywhere\n
    80/tcp (v6)                ALLOW       Anywhere (v6)

Fase 5:verifica

Digita l'indirizzo IP del passaggio 3 nel browser e viene visualizzata la pagina di destinazione di Apache.

Azioni aggiuntive

I seguenti comandi possono aiutarti a gestire Apache:

Comando Azione
sudo systemctl stop apache2 Stop
sudo systemctl start apache2 Inizia
sudo systemctl restart apache2 Riavvia
sudo systemctl enable apache2 Avvia automaticamente all'avvio del server
sudo systemctl disable apache2 Disattiva l'avvio automatico

Conclusione

Dopo aver completato questi passaggi, Apache è in esecuzione sul tuo server ed è pronto per distribuire un'applicazione.


Linux
  1. Come installare Apache Maven su Debian 9

  2. Installa Apache Cassandra su Debian 7

  3. Installa phpMyAdmin su Debian 11 con Apache

  4. Come installare Let's Encrypt SSL con Apache su Debian 11

  5. Come installare MongoDB su Debian 11

Come installare Apache Subversion su Debian 11

Come installare Apache su Debian 7

Come installare Apache su Debian 8.2

Come installare Apache su Debian 10

Come installare Apache Tomcat su Debian 10

Come installare Apache CouchDB su Debian 10