I am trying to launch my server with the SSL protocol, however I receive a big error message
"400 Bad Requests The plain HTTP request was sent to HTTPS port nginx/1.14.2"
I tried solutions like "ssl off" in the configuration file, but nothing changes, does anyone see a fault in my files?
server {
listen 443 ssl;
root /usr/share/nginx/html;
index index.html index.htm;
server_name example;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_certificate /etc/nginx/ssl/example.crt;
ssl_certificate_key /etc/nginx/ssl/example.key;
location / {
try_files $uri $uri/ =404;
}
}
And the Docker file :
FROM debian:buster
RUN apt-get -y update \
&& apt-get -y install nginx \
&& apt-get install openssl
RUN mkdir /etc/nginx/ssl
RUN openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes \
-keyout /etc/nginx/ssl/example.key \
-out /etc/nginx/ssl/example.crt \
-subj "/C=FR/ST=IDF/L=Paris/O=42/OU=42/CN=example/UID=example"
COPY conf/default /etc/nginx/sites-enabled/default
EXPOSE 443
CMD ["nginx", "-g", "daemon off;"]