[英]How to restore WordPress to NGINX after using Certbot?
I'm using a Bitnami stack on AWS to host a WordPress site, using NGINX.我在 AWS 上使用 Bitnami 堆栈来托管 WordPress 站点,使用 NGINX。 I've just installed Certbot via SSH and used the
sudo certbot --nginx
command.我刚刚通过 SSH 安装了 Certbot 并使用了
sudo certbot --nginx
命令。
When I navigate to my domain, it's now using HTTPS as promised - but it's displaying the default NGINX welcome page instead of my WordPress site.当我导航到我的域时,它现在按照承诺使用 HTTPS - 但它显示的是默认的 NGINX 欢迎页面,而不是我的 WordPress 站点。
I've compared /opt/bitnami/nginx/conf/nginx.conf with the backup I made prior to the operation, and they look identical.我已经将 /opt/bitnami/nginx/conf/nginx.conf 与我在操作之前所做的备份进行了比较,它们看起来完全相同。 I did not backup my /etc/nginx directory, so I can't confirm if the changes were made there or not.
我没有备份我的 /etc/nginx 目录,所以我无法确认是否在那里进行了更改。
What else should I look for?我还应该寻找什么? How can I get my WordPress back up while still keeping HTTPS?
如何在保留 HTTPS 的同时备份我的 WordPress?
Bitnami developer here, Bitnami 开发人员在这里,
The process of installing Certbot on your machine running the official command sudo apt-get install certbot python-certbot-nginx
, also installed NGINX using your system package manager.在运行官方命令
sudo apt-get install certbot python-certbot-nginx
的机器上安装 Certbot 的过程,还使用系统包管理器安装了 NGINX。 You will need to stop and disable the system NGINX service and then configure the NGINX under the Bitnami installation to use your certbot certificates.您需要停止并禁用系统 NGINX 服务,然后在 Bitnami 安装下配置 NGINX 以使用您的 certbot 证书。 To do so, run:
为此,请运行:
sudo service nginx stop
sudo systemctl disable nginx.service
Then, to configure your SSL certificates located at the /etc/letsencrypt/live/YOUR_DOMAIN/
directory, run the next commands that will stop the Bitnami services, backup the dummy SSL certificates included by default in the Bitnami NGINX installation, symlink the Certbot certificate to the /opt/bitnami/nginx/conf
directory, and start the Bitnami services again.然后,要配置位于
/etc/letsencrypt/live/YOUR_DOMAIN/
目录中的 SSL 证书,运行将停止 Bitnami 服务的下一个命令,备份 Bitnami NGINX 安装中默认包含的虚拟 SSL 证书,符号链接 Certbot 证书到/opt/bitnami/nginx/conf
目录,并再次启动 Bitnami 服务。 I used YOUR_DOMAIN
as a placeholder for your actual value.我使用
YOUR_DOMAIN
作为您实际价值的占位符。 Please substitute it before running the commands请在运行命令之前替换它
# Stop Bitnami services
sudo /opt/bitnami/ctlscript.sh stop
# Backup dummy SSL certificates
sudo mv /opt/bitnami/nginx/conf/server.crt{,.bck}
sudo mv /opt/bitnami/nginx/conf/server.key{,.bck}
sudo mv /opt/bitnami/nginx/conf/server.csr{,.bck}
# Link Certbot certificates
sudo ln -sfv /etc/letsencrypt/live/YOUR_DOMAIN/fullchain.pem /opt/bitnami/nginx/conf/server.crt
sudo ln -sfv /etc/letsencrypt/live/YOUR_DOMAIN/privkey.pem /opt/bitnami/nginx/conf/server.key
# Start Bitnami services
sudo /opt/bitnami/ctlscript.sh start
Optionally, you will want to force the HTTP to HTTPS redirection in NGINX.或者,您需要在 NGINX 中强制将 HTTP 重定向到 HTTPS。 To do so, edit the
/opt/bitnami/nginx/conf/bitnami/bitnami.conf
file and include the next line return 301 https://$host$request_uri;
为此,请编辑
/opt/bitnami/nginx/conf/bitnami/bitnami.conf
文件并包含下一行return 301 https://$host$request_uri;
right below the server_name
in the server
block for the HTTP server so it looks like this:在 HTTP 服务器的
server
块中的server_name
正下方,它看起来像这样:
# HTTP server
server {
listen 80;
server_name localhost;
return 301 https://$host$request_uri;
#include "/opt/bitnami/nginx/conf/bitnami/phpfastcgi.conf";
include "/opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf";
}
Finally, restart NGINX to apply changes最后,重新启动 NGINX 以应用更改
sudo /opt/bitnami/ctlscript.sh restart nginx
In addition to this, we include the lego
tool to create and manage Let's Encrypt certificates.除此之外,我们还包括
lego
工具来创建和管理 Let's Encrypt 证书。 You can find more information about how to create and configure a Let's Encrypt certificate in your Bitnami installation using the guide below您可以使用以下指南找到有关如何在 Bitnami 安装中创建和配置 Let's Encrypt 证书的更多信息
https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/#alternative-approach https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/#alternative-approach
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.