Copy the .crt and .key files to the server under /etc/ssl/certs and /etc/ssl/private respectively (set permissions to chmod 600 for the private key).
Apache configuration:
Create or edit /etc/apache2/sites-available/example.com-le-ssl.conf:
```apache
ServerName example.com
DocumentRoot /var/www/example.com
SSLEngine on
SSLCertificateFile /etc/ssl/certs/example.com.crt
SSLCertificateKeyFile /etc/ssl/private/example.com.key
SSLCertificateChainFile /etc/ssl/certs/chain.pem
AllowOverride All
Require all granted
ErrorLog ${APACHE_LOG_DIR}/example_error.log
CustomLog ${APACHE_LOG_DIR}/example_access.log combined
```
Enable SSL module and site:
```bash
sudo a2enmod ssl
sudo a2ensite example.com-le-ssl.conf
sudo systemctl restart apache2
```
Nginx configuration:
Open or create /etc/nginx/sites-available/example.com.conf and include the SSL block:
```nginx
server {
listen 443 ssl http2;
server_name example.com;
root /var/www/example.com;
index index.php index.html index.htm;
ssl_certificate /etc/ssl/certs/example.com.crt;
ssl_certificate_key /etc/ssl/private/example.com.key;
ssl_trusted_certificate /etc/ssl/certs/chain.pem;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
access_log /var/log/nginx/example_access.log;
error_log /var/log/nginx/example_error.log;
}
```
Enable the site and restart:
```bash
sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
```
Thank you for your feedback.
Sorry about that :( We'll work to make it better.
You voted before.
1 times viewed | 0 people fount it helpful