HowTo/Apache: mudanças entre as edições
< HowTo
(Criou página com '* Alterar o arquivo: '''/etc/apache2/apache2.conf''' <syntaxhighlight lang="bash" style="border: 1px solid blue;"> #<Directory /var/www/> <Directory /home/*/public_html/> Options Indexes FollowSymLinks #AllowOverride None AllowOverride All Require all granted </Directory> </syntaxhighlight> * E o arquivo: '''/etc/apache2/sites-enabled/000-default.conf''' <syntaxhighlight lang="bash" style="border: 1px solid blue;"> #DocumentRoot /var/www/html DocumentRoot /home/<us...') |
Sem resumo de edição |
||
(3 revisões intermediárias pelo mesmo usuário não estão sendo mostradas) | |||
Linha 1: | Linha 1: | ||
{{SUBHEAD}} | |||
==Instalação== | |||
<syntaxhighlight lang="bash" style="border: 1px solid blue;"> | |||
sudo apt install apache2 | |||
</syntaxhighlight> | |||
==Configuração== | |||
* Alterar o arquivo: '''/etc/apache2/apache2.conf''' | * Alterar o arquivo: '''/etc/apache2/apache2.conf''' | ||
<syntaxhighlight lang="bash" style="border: 1px solid blue;"> | <syntaxhighlight lang="bash" style="border: 1px solid blue;"> | ||
Linha 30: | Linha 36: | ||
<syntaxhighlight lang="bash" style="border: 1px solid blue;"> | <syntaxhighlight lang="bash" style="border: 1px solid blue;"> | ||
sudo -u www-data test -r /home/<username>/public_html/ && echo OK || echo not OK | sudo -u www-data test -r /home/<username>/public_html/ && echo OK || echo not OK | ||
</syntaxhighlight> | |||
ou | |||
<syntaxhighlight lang="bash" style="border: 1px solid blue;"> | |||
sudo -u www-data bash | |||
cd /home/<username>/public_html | |||
</syntaxhighlight> | </syntaxhighlight> |
Edição atual tal como às 20h32min de 1 de julho de 2024
Apache
Instalação
sudo apt install apache2
Configuração
- Alterar o arquivo: /etc/apache2/apache2.conf
#<Directory /var/www/>
<Directory /home/*/public_html/>
Options Indexes FollowSymLinks
#AllowOverride None
AllowOverride All
Require all granted
</Directory>
- E o arquivo: /etc/apache2/sites-enabled/000-default.conf
#DocumentRoot /var/www/html
DocumentRoot /home/<username>/public_html
ATENÇÃO: Pegadinha ao definir o DocumentRoot no diretório: /home/<username>
- Deve-se conceder permissão de execução ao grupo do usuário no diretório do usuário em: /home
sudo chmod g+x /home/<username>
- Também é necessário incluir o usuário do Apache www-data ao grupo do usuário:
sudo usermod -aG <username> www-data
- Teste de leitura para o usuário do Apache no novo diretório:
sudo -u www-data test -r /home/<username>/public_html/ && echo OK || echo not OK
ou
sudo -u www-data bash
cd /home/<username>/public_html