Posts com Tag ‘cloud’

1. Instalar Apache e PHP
# apt-get install apache2 apache2-utils libapache2-mod-php php apache2-doc

2. Atualize as definições do firewall
Por padrão, o firewall do Ubuntu está desativado. Deve-se atualizar a configuração iptables para permitir o tráfego HTTP. Atualize iptables com os comandos a seguir:

# iptables -I INPUT 6 -m state --state NEW -p tcp --dport 80 -j ACCEPT
# netfilter-persistent save

Pronto, o acesso a página default do Apache estará liberada em http://ip-servidor/

3. Alguns comandos de verificação
3.1 Versão do PHP:
$ php -v
PHP 8.1.2-1ubuntu2.13 (cli) (built: Jun 28 2023 14:01:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.13, Copyright (c), by Zend Technologies

3.2 Verificar sintaxe do arquivo virtualhost:
# apache2ctl -S

3.3 Verificar se o serviço do Apache está ativo:
# ps -A | grep apache2
20614 ? 00:00:00 apache2
20616 ? 00:00:00 apache2
20617 ? 00:00:00 apache2
20618 ? 00:00:00 apache2
20619 ? 00:00:00 apache2
20620 ? 00:00:00 apache2
20874 ? 00:00:00 apache2
20875 ? 00:00:00 apache2
20876 ? 00:00:00 apache2

3.4 Configuração do PHP:
Criar o arquivo /var/www/html/phpinfo.php com o conteúdo abaixo e acessá-lo com o navegador em http://ip-servidor/phpinfo.php:
<?php
phpinfo();
?>

Referências:
1- Instalar servidor LAMP (Linux + Apache + PHP + MySQL) no Debian
2- Oracle Cloud: Instalar o Apache e o PHP em uma Instância com Ubuntu
3- Oracle Cloud: criar um servidor Web em uma instância de computação