Skip to content

Instantly share code, notes, and snippets.

@nullx5
Last active December 6, 2022 22:10
Show Gist options
  • Save nullx5/2c95fdffa1e28cdec3a5bf8c533442a5 to your computer and use it in GitHub Desktop.
Save nullx5/2c95fdffa1e28cdec3a5bf8c533442a5 to your computer and use it in GitHub Desktop.
Configurando HTTPS letsencrypt con cerbot en apache
###########################################################
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --apache
###########################################################
REDIRECIONAR HTTP A HTTPS
/etc/apache2/sites-available/000-default-le-ssl.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName blessedc0de.brazilsouth.cloudapp.azure.com
Redirect / https://blessedc0de.brazilsouth.cloudapp.azure.com
</VirtualHost>
<VirtualHost *:443>
ServerName blessedc0de.brazilsouth.cloudapp.azure.com
DocumentRoot /var/www/html
SSLEngine On
#############################################################
sudo systemctl restart apache2
191.233.245.24
blessedc0de.brazilsouth.cloudapp.azure.com
#############################################################
INPIDE QUE SE ACCEDA POR LA IP SOLO ACCESO POR EL DOMINIO
cd /var/www/html
.htaccess
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://blessedc0de.brazilsouth.cloudapp.azure.com/$1 [L,R=301,QSA]
RewriteCond %{HTTP_HOST} !^blessedc0de.brazilsouth.cloudapp.azure\.com$ [NC]
RewriteRule (.*) https://blessedc0de.brazilsouth.cloudapp.azure.com/$1 [L,R=302,QSA]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment