quarta-feira, 3 de abril de 2013

Habilitando e desabilitando sites e módulos do Apache


O Apache possui ferramentas simples para habilitar e desabilitar módulos e sites. Para listar os módulos ativos, digite:

# a2dismod
Your choices are: actions alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgi deflate dir env mime negotiation php5 reqtimeout setenvif status
Which module(s) do you want to disable (wildcards ok)?

Para mostrar todos os módulos disponíveis, digite:

# a2enmod
Your choices are: actions alias asis auth_basic auth_digest authn_alias authn_anon authn_dbd authn_dbm authn_default authn_file authnz_ldap authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cern_meta cgi cgid charset_lite dav dav_fs dav_lock dbd deflate dir disk_cache dump_io env expires ext_filter file_cache filter headers ident imagemap include info ldap log_forensic mem_cache mime mime_magic mod-dnssd negotiation php5 proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http proxy_scgi reqtimeout rewrite setenvif speling ssl status substitute suexec unique_id userdir usertrack version vhost_alias
Which module(s) do you want to enable (wildcards ok)?

Para habilitar o módulos ssl digite:

# a2enmod ssl
Enabling module ssl.
See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
Run '/etc/init.d/apache2 restart' to activate new configuration!

Após cada mudança é necessário reiniciar o Apache.

# /etc/init.d/apache2 restart
Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
.

Olha aí a porta 443 aberta

# netstat -na | grep :443
tcp        0      0 172.20.120.4:45783      178.216.201.51:443      ESTABELECIDA
tcp        0      0 172.20.120.4:49113      172.20.1.82:443         ESTABELECIDA
tcp        0      0 172.20.120.4:37642      31.172.30.3:443         ESTABELECIDA
tcp6       0      0 :::443                  :::*                    OUÇA      

Para desabilitar o módulos ssl, digite:

# a2dismod ssl
Module ssl disabled.
Run '/etc/init.d/apache2 restart' to activate new configuration!
# /etc/init.d/apache2 restart
Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
.
# netstat -na | grep :443
tcp        0      0 172.20.120.4:45783      178.216.201.51:443      ESTABELECIDA
tcp        0      0 172.20.120.4:49113      172.20.1.82:443         ESTABELECIDA
tcp        0      0 172.20.120.4:37642      31.172.30.3:443         ESTABELECIDA

Para mostrar os sites virtuais configurados no Apache, digite:

# a2ensite
Your choices are: default default-ssl moodle
Which site(s) do you want to enable (wildcards ok)?

Para habilitar o site moodle, digite:

# a2ensite moodle
Enabling site moodle.
Run '/etc/init.d/apache2 reload' to activate new configuration!
# /etc/init.d/apache2 restart
Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
.

Para desabilitá-lo, digite:

# a2dissite moodle
Site moodle disabled.
Run '/etc/init.d/apache2 reload' to activate new configuration!
# /etc/init.d/apache2 restart
Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
.

Você pode personalizar seu Apache para carregar somente os módulos que realmente são necessário, ou os sites que realmente serão usados.

Nenhum comentário:

Postar um comentário