[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Diferenças
Aqui você vê as diferenças entre duas revisões dessa página.
Próxima revisão | Revisão anterior | ||
pt-br:howtos:network_services:setup_apache [2022/03/18 00:57 (UTC)] – criada carriunix | pt-br:howtos:network_services:setup_apache [2022/03/18 01:27 (UTC)] (atual) – carriunix | ||
---|---|---|---|
Linha 1: | Linha 1: | ||
- | (work in progress) | + | |
+ | ====== Configurando um servidor httpd Apache ====== | ||
+ | Este é um exemplo geral de como obter um serviço básico de httpd instalado e funcionando. | ||
+ | |||
+ | Aplica-se a: | ||
+ | * Slackware 14.1 (e possivelmente versões anteriores) | ||
+ | * Apache 2 (e possivelmente versões anteriores) | ||
+ | |||
+ | ====== Configuração básica ====== | ||
+ | |||
+ | Edite / | ||
+ | |||
+ | < | ||
+ | |||
+ | # opcional, exige a configuração de DNS apropriada | ||
+ | ServerAdmin you@myawesomeserver.com | ||
+ | ServerName www.myawesomeserver.com: | ||
+ | |||
+ | < | ||
+ | AllowOverride none | ||
+ | Require all denied | ||
+ | </ | ||
+ | |||
+ | DocumentRoot "/ | ||
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | DirectoryIndex index.html index.htm index.pl index.php | ||
+ | </ | ||
+ | |||
+ | ErrorLog "/ | ||
+ | |||
+ | CustomLog "/ | ||
+ | |||
+ | # Opcional, mas interessante: | ||
+ | Include / | ||
+ | # Opcional | ||
+ | Include / | ||
+ | </ | ||
+ | |||
+ | Todas as outras configurações padrão são apropriadas. | ||
+ | |||
+ | Fazer o httpd iniciar com o boot. | ||
+ | |||
+ | < | ||
+ | / | ||
+ | |||
+ | **DICA:** Com essas configurações, | ||
+ | |||
+ | ====== Diretórios de usuários ====== | ||
+ | |||
+ | Isso permitirá que os usuários tenham espaço web individual (/ | ||
+ | |||
+ | Exemplo: < | ||
+ | |||
+ | Edite / | ||
+ | < | ||
+ | |||
+ | LoadModule authz_host_module lib64/ | ||
+ | LoadModule authz_user_module lib64/ | ||
+ | LoadModule authz_core_module lib64/ | ||
+ | LoadModule userdir_module lib64/ | ||
+ | Include / | ||
+ | |||
+ | Edite / | ||
+ | < | ||
+ | |||
+ | < | ||
+ | AllowOverride FileInfo AuthConfig Limit Indexes | ||
+ | Options MultiViews Indexes SymLinksIfOwnerMatch | ||
+ | Require method GET POST OPTIONS | ||
+ | </ | ||
+ | |||
+ | Reinicie o Apache | ||
+ | < | ||
+ | |||
+ | |||
+ | ====== Habilitar CGI-BIN ====== | ||
+ | |||
+ | Isso permite a execução de scripts CGI em seu servidor web. | ||
+ | |||
+ | Edite / | ||
+ | < | ||
+ | |||
+ | LoadModule proxy_module | ||
+ | LoadModule proxy_fcgi_module lib64/ | ||
+ | LoadModule proxy_scgi_module lib64/ | ||
+ | LoadModule cgid_module | ||
+ | |||
+ | < | ||
+ | ScriptAlias /cgi-bin/ "/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | AllowOverride None | ||
+ | Options None | ||
+ | Require all granted | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | AddHandler cgi-script .cgi .pl | ||
+ | </ | ||
+ | |||
+ | Reinicie o Apache | ||
+ | < | ||
+ | |||
+ | **DICA:** Seu diretório cgi-bin será / | ||
+ | |||
+ | Exemplo: < | ||
+ | |||
+ | **NOTA**: Isso não se aplica a scripts PHP, veja abaixo. | ||
+ | |||
+ | |||
+ | |||
+ | ====== CGI-BIN de usuários ====== | ||
+ | |||
+ | Isso permitirá que os usuários executem scripts CGI a partir de seu diretório / | ||
+ | |||
+ | Exemplo: < | ||
+ | |||
+ | A configuração do CGI-BIN foi descrita acima. | ||
+ | |||
+ | Edite / | ||
+ | < | ||
+ | |||
+ | < | ||
+ | Options ExecCGI | ||
+ | SetHandler cgi-script | ||
+ | </ | ||
+ | |||
+ | Reinicie o Apache | ||
+ | < | ||
+ | |||
+ | ====== Habilitar PHP ====== | ||
+ | |||
+ | [[howtos: | ||
+ | |||
+ | ====== Hosts virtuais ====== | ||
+ | |||
+ | Edite / | ||
+ | |||
+ | < | ||
+ | |||
+ | Include / | ||
+ | |||
+ | Edite / | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | ServerAdmin webmaster@www.server1.com | ||
+ | DocumentRoot "/ | ||
+ | ServerName server1.com | ||
+ | ServerAlias www.server1.com | ||
+ | ErrorLog "/ | ||
+ | CustomLog "/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ServerAdmin webmaster@www.server2.com | ||
+ | DocumentRoot "/ | ||
+ | ServerName server2.com | ||
+ | ServerAlias www.server2.com | ||
+ | ErrorLog "/ | ||
+ | CustomLog "/ | ||
+ | </ | ||
+ | |||
+ | Reinicie o Apache | ||
+ | < | ||
+ | |||
+ | **NOTA:** Eu executo meus vhosts como usuários, então, os Document Root estão nos diretórios /home/user. Você não tem que fazer isso. Você pode colocar os Document Root em qualquer lugar que desejar. | ||
+ | |||
+ | Exemplo: | ||
+ | |||
+ | / | ||
+ | / | ||
+ | |||
+ | **NOTA 2:** Isso não afeta a configuração padrão do seu servidor web em / | ||
+ | |||
+ | |||
+ | ====== Vhosts com diretórios CGI-BIN individuais ====== | ||
+ | |||
+ | Se você tiver hosts virtuais que precisam de CGI (ou precisam de CGI em seu próprio diretório), | ||
+ | |||
+ | Edite / | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | Options ExecCGI | ||
+ | SetHandler cgi-script | ||
+ | </ | ||
+ | |||
+ | Reinicie o Apache | ||
+ | < | ||
+ | |||
+ | **DICA:** Eu normalmente coloco esses trechos junto com as respectivas entradas < | ||
+ | |||
+ | **NOTA:** Mude o "/ | ||
+ | |||
+ | |||
+ | ====== HTTPS / SSL ======= | ||
+ | A ser adicionado no arquivo original. | ||
+ | |||
+ | |||
+ | ====== SNI HTTPS / SSL (Name based https) ====== | ||
+ | A ser adicionado no arquivo original. | ||
+ | |||
+ | |||
+ | ====== Fontes ====== | ||
+ | |||
+ | * Originalmente escrito por [[wiki: | ||
+ | |||
+ | {{tag> |