I'm using a Bitnami stack on AWS to host a WordPress site, using NGINX. I've just installed Certbot via SSH and used the sudo certbot --nginx
command.
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.
I've compared /opt/bitnami/nginx/conf/nginx.conf with the backup I made prior to the operation, and they look identical. I did not backup my /etc/nginx directory, so I can't confirm if the changes were made there or not.
What else should I look for? How can I get my WordPress back up while still keeping HTTPS?
Bitnami developer here,
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. 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. 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. I used YOUR_DOMAIN
as a placeholder for your actual value. 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. To do so, edit the /opt/bitnami/nginx/conf/bitnami/bitnami.conf
file and include the next line 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 {
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
sudo /opt/bitnami/ctlscript.sh restart nginx
In addition to this, we include the lego
tool to create and manage Let's Encrypt certificates. You can find more information about how to create and configure a Let's Encrypt certificate in your Bitnami installation using the guide below
https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/#alternative-approach
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.