sudo apt install certbot python3-certbot-nginx # Для Nginx
sudo apt install certbot python3-certbot-apache # Для Apache
sudo certbot --nginx -d example.com -d www.example.com
sudo nano /etc/nginx/sites-available/example.com
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# Оптимизация HTTPS
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_session_cache shared:SSL:10m;
}
sudo systemctl reload nginx
sudo a2enmod ssl
<VirtualHost *:443>
ServerName example.com
SSLEngine on
SSLCertificateFile /path/to/cert.pem
SSLCertificateKeyFile /path/to/privkey.pem
SSLCertificateChainFile /path/to/chain.pem
</VirtualHost>
sudo systemctl restart apache2
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
/* Было */
background: url('http://example.com/bg.jpg');
/* Стало */
background: url('//example.com/bg.jpg');