0% found this document useful (0 votes)
44 views13 pages

Criar Certificado Autoassinado Apache2

The document provides a step-by-step tutorial for enabling HTTPS on an Apache server. It details how to install the necessary Apache modules, generate an SSL certificate, configure the Apache virtual hosts and redirect HTTP to HTTPS. The tutorial explains the commands needed to set up HTTPS and force secure connections on Apache.

Uploaded by

César Novoa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views13 pages

Criar Certificado Autoassinado Apache2

The document provides a step-by-step tutorial for enabling HTTPS on an Apache server. It details how to install the necessary Apache modules, generate an SSL certificate, configure the Apache virtual hosts and redirect HTTP to HTTPS. The tutorial explains the commands needed to set up HTTPS and force secure connections on Apache.

Uploaded by

César Novoa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.

tips/pt-br/apache-pt-br/habilitar-https-no-apache/

1 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

2 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

3 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

apt-get update
apt-get install apache2 openssl

4 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

a2enmod ssl
a2enmod rewrite

vi /etc/apache2/apache2.conf

<Directory /var/www/html>
AllowOverride All
</Directory>

mkdir /etc/apache2/certificate
cd /etc/apache2/certificate
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out apache-certificate.crt

Generating a RSA private key


............++++
.......................................................++++
writing new private key to 'apache.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:BR
State or Province Name (full name) [Some-State]:Rio de Janeiro
Locality Name (eg, city) []:

5 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

Organization Name (eg, company) [Internet Widgits Pty Ltd]:TechExpert


Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:200.200.200.200
Email Address []:

vi /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/certificate/apache-certificate.crt
SSLCertificateKeyFile /etc/apache2/certificate/apache.key
</VirtualHost>

<VirtualHost *:80>
RewriteEngine On

6 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

RewriteCond %{HTTPS} !=on


RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
</virtualhost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/certificate/apache-certificate.crt
SSLCertificateKeyFile /etc/apache2/certificate/apache.key
</VirtualHost>

service apache2 restart

7 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

9 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

10 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

11 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

12 of 13 06/07/2022 23:31
Tutorial - Habilitar HTTPS no Apache [ Passo a passo ] https://techexpert.tips/pt-br/apache-pt-br/habilitar-https-no-apache/

13 of 13 06/07/2022 23:31

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy