Hi, I made my first deployment recently with an ec2 instance and wanted to make the website https, I decided to use let'sEncrypt for the ssl certificates but after running the command to make the keys, I'm now getting a 403 forbidden error, my logs show that I don't have access to my files anymore even though I have full permissions on every folder.
Here is my nginx.conf :
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
client_max_body_size 8M;
# HTTP server block to redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name lydiapp.site www.lydiapp.site;
# Redirect all HTTP traffic to HTTPS
return 301 https://$host$request_uri;
}
# HTTPS server block to serve your website over HTTPS
server {
listen 443 ssl;
server_name lydiapp.site www.lydiapp.site;
ssl_certificate /etc/letsencrypt/live/lydiapp.site/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/lydiapp.site/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# Your website's root directory
root /var/www/Lydiapp/;
index index.html index.htm index.nginx-debian.html;
# Additional configuration for serving your website's content
# ...
# Error pages
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
internal;
}
}
}
I believe the problem could come from the nginx.conf file, does anyone know what I should change in order to fix the 403 error ?
My domain is: lydiapp.site
I ran this command: sudo certbot --nginx -d lydiapp.site -d www.lydiapp.site
It produced this output: HTTPS block in the .conf file
My web server is (include version): nginx/1.18.0 (Ubuntu)
The operating system my web server runs on is (include version): Ubuntu 24.04
My hosting provider, if applicable, is: AWS
I can login to a root shell on my machine (yes or no, or I don't know): yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): 1.21.0
Hi @Hautzii, and welcome to the LE community forum
You are not showing enough information to be certain about what is going wrong.
Please answer all the questions provided when you open a HELP topic:
Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
My domain is:
I ran this command:
It produced this output:
My web server is (include version):
The operating system my web server runs on is (include version):
My hosting provider, if applicable, is:
I can login to a root shell on my machine (yes or no, or I don't know):
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot):
Since you haven't answered any of the questions...
Show us:
nginx -T
And maybe we can fix was it broken therein - NOT because certbot broke anything in your config.
The nignx config is likely too strict with HTTPS access.
All that certbot may have done is redirect HTTP to HTTPS.
No, nothing in there, I ended up removing it. Will update certbot.
Just tried to update it and I'm getting this message :
certbot is already the newest version (1.21.0-1build1).
It worked fine when I first installed it but it replaced my whole site with the welcome to nginx page, it broke when I tried to put my website instead of that welcome page