Este tutorial ensina como instalar e configurar o servidor Apache em sistemas Linux, incluindo atualização, ativação do serviço e teste no navegador.

1. Atualize os pacotes do sistema
Você deve ver algo como "active (running)".
ou
http://SEU_ENDEREÇO_IP
Se estiver tudo certo, você verá a página padrão do Apache: "It works!"
var/www/html
Você pode colocar seus arquivos HTML, PHP, etc. nesse local.

1. Atualize os pacotes do sistema
Debian/Ubuntu:
Bash:
sudo apt update
sudo apt upgrade -y
CentOS/RHEL/Fedora:
Bash:
sudo dnf update -y
# ou use 'yum' em versões antigas
2. Instale o Apache
Debian/Ubuntu:
Bash:
sudo apt install apache2 -y
CentOS/RHEL:
Bash:
sudo yum install httpd -y
Fedora:
Bash:
sudo dnf install httpd -y
3. Inicie e habilite o Apache
Debian/Ubuntu:
Bash:
sudo systemctl start apache2
sudo systemctl enable apache2
CentOS/RHEL/Fedora:
Bash:
sudo systemctl start httpd
sudo systemctl enable httpd
4. Verifique se o Apache está rodando
Debian/Ubuntu:
Bash:
sudo systemctl status apache2
CentOS/RHEL/Fedora:
Bash:
sudo systemctl status httpd
Você deve ver algo como "active (running)".
5. Configure o Firewall (opcional)
Debian/Ubuntu (UFW):
Bash:
sudo ufw allow 'Apache'
sudo ufw enable
CentOS/RHEL/Fedora (firewalld):
Bash:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
6. Teste no navegador
Abra o navegador e acesse:ou
http://SEU_ENDEREÇO_IP
Se estiver tudo certo, você verá a página padrão do Apache: "It works!"
7. Onde ficam os arquivos do site?
O diretório padrão é:var/www/html
Você pode colocar seus arquivos HTML, PHP, etc. nesse local.