在XAMPP服务器上使用letsencrypt安装SSL证书



我正在使用命令:

sudo certbot --apache-ctl /opt/lampp/bin/apachectl

在XAMPP服务器上安装证书。但是,证书安装在/etc/apache2位置。如何重新指向XAMPP Apache服务器?日志如下:

ubuntu@ip-172-31-33-70:~$ sudo certbot --apache-ctl /opt/lampp/bin/apachectl
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated)  (Enter 'c' to cancel): ploshop.co.in
Cert not yet due for renewal
You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/ploshop.co.in.conf)
What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Attempt to reinstall this existing certificate
2: Renew & replace the cert (limit ~5 per 7 days)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Renewing an existing certificate
Created an SSL vhost at /etc/apache2/sites-available/000-default-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/000-default-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/000-default-le-ssl.conf
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Redirecting vhost in /etc/apache2/sites-enabled/000-default.conf to ssl vhost in /etc/apache2/sites-available/000-default-le-ssl.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Your existing certificate has been successfully renewed, and the new certificate
has been installed.
The new certificate covers the following domains: https://ploshop.co.in
You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=ploshop.co.in
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/ploshop.co.in/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/ploshop.co.in/privkey.pem
Your cert will expire on 2021-11-17. To obtain a new or tweaked
version of this certificate in the future, simply run certbot again
with the "certonly" option. To non-interactively renew *all* of
your certificates, run "certbot renew"
- If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
Donating to EFF:                    https://eff.org/donate-le
ubuntu@ip-172-31-33-70:~$

根据您的安装修改位置。我使用的是默认路径。

编辑文件

Linux:/opt/lampp/apache/conf/额外的/httpd-ssl.conf

Windows:/xampp/apache/conf/额外的/httpd-ssl.conf

找到定义端口443侦听器的部分:

修改这部分:

<VirtualHost *:443>
...
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"

:

<VirtualHost *:443>
...
SSLEngine on
SSLCertificateFile "/etc/letsencrypt/live/ploshop.co.in/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/ploshop.co.in/privkey.pem"

不要忘记重启apache.

最新更新