Diferència entre revisions de la pàgina «Grup4 - 27 Implementar HTTPS i HSTS (HTTPS only) en cloud extern.»

De Wiket
Salta a la navegació Salta a la cerca
Línia 15: Línia 15:
 
  <IfModule mod_ssl.c>
 
  <IfModule mod_ssl.c>
 
  <VirtualHost *:443>
 
  <VirtualHost *:443>
   SSLEngine On
+
   '''SSLEngine On'''
 
   ServerName posturalhigiene.ml
 
   ServerName posturalhigiene.ml
 
   ServerAlias www.posturalhigiene.ml
 
   ServerAlias www.posturalhigiene.ml
   ProxyPreserveHost on
+
   '''ProxyPreserveHost on'''
 
   ProxyRequests Off
 
   ProxyRequests Off
 
   ProxyPass / http://localhost:5000/
 
   ProxyPass / http://localhost:5000/
 
   ProxyPassReverse / http://localhost:5000/
 
   ProxyPassReverse / http://localhost:5000/
   RequestHeader set X-Forwarded-Proto "https"
+
   '''RequestHeader set X-Forwarded-Proto "https"'''
   RequestHeader set X-Forwarded-Port "443
+
   '''RequestHeader set X-Forwarded-Port "443'''
 
  Include /etc/letsencrypt/options-ssl-apache.conf
 
  Include /etc/letsencrypt/options-ssl-apache.conf
 
  SSLCertificateFile /etc/letsencrypt/live/posturalhigiene.ml/fullchain.pem
 
  SSLCertificateFile /etc/letsencrypt/live/posturalhigiene.ml/fullchain.pem

Revisió del 23:31, 22 març 2022

Para configurar https primero debemos cambiar la información de una tabla en mysql para que no escuche por el 5000 y si por 443=https.

Una vez realizado estos pasos deberemos activar los siguientes modulos:


a2enmod proxy
a2enmod proxy_http
a2enmod headers
a2enmos ssl

Una vez tengamos hasta este paso configurado [proxy_configuration] debemos de generar el certificado para la página de higiene postural


certbot --apache

Elegimos redirección de http a https y finalizamos la configuración
Automáticamente nos generara un nuevo fichero de configuración (sitio) añadiendo los certificados ssl pero deberemos de añadir instrucciones para que funcione correctamente

<IfModule mod_ssl.c>
<VirtualHost *:443>
 SSLEngine On
 ServerName posturalhigiene.ml
 ServerAlias www.posturalhigiene.ml
 ProxyPreserveHost on
 ProxyRequests Off
 ProxyPass / http://localhost:5000/
 ProxyPassReverse / http://localhost:5000/
 RequestHeader set X-Forwarded-Proto "https"
 RequestHeader set X-Forwarded-Port "443
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/posturalhigiene.ml/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/posturalhigiene.ml/privkey.pem
</VirtualHost>
</IfModule>