Wiki do Laboratório MARTIN → Instalacao Apache2 e SSL
 
 

Instalacao Apache2 e SSL

Last modified on Monday, November 9th 2009 at 4:49 PM.

1 - Instalando o Apache2

sudo apt-get install apache2

2 - Gerando o certificado

sudo apt-get install ssl-cert

sudo mkdir /etc/apache2/ssl

sudo make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem

Coloque o nome da máquina que será acessado com seu devido domínio

sudo a2enmod ssl

sudo /etc/init.d/apache2 force-reload

3 - Criar o virtualhost

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/ssl

Faça uma cópia do arquivo default

sudo vim /etc/apache2/sites-available/ssl

Acrescente e edite as linhas necessárias como abaixo:

NameVirtualHost *:443 <virtualhost *:443>

    ServerAdmin NOME-USUARIO-ADMIN@NOME-DOMINIO
    ServerName NOME-MAQUINA.NOME-DOMINIO

    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/apache.pem

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"

    <Directory "/usr/share/doc/">
           Options Indexes MultiViews FollowSymLinks
           AllowOverride None
           Order deny,allow
           Deny from all
           Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

4 - Abilite o SSL

sudo a2enmod ssl

sudo a2ensite ssl

5 - Recaregue o apache

sudo /etc/init.d/apache2 reload

6 - Teste

https://NOME-MAQUINA.NOME-DOMINIO