On lun., 2025-11-24 at 11:15 +0100, Michel Verdier wrote:
> Le 24 novembre 2025 jean-christophe Énée a écrit :
>
> > * comment faire pour rediriger automatiquement vers https ?
>
> Tu as un exemple de conf nginx ici :
> https://www.baeldung.com/ops/nginx-http-https-domains-redirection
>
>
jean-christophe@blues-softwares:~/Documents/Script$ sudo nginx -t
2025/11/24 15:54:00 [emerg] 12606#12606: "server" directive is not
allowed here in /etc/nginx/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
jean-christophe@blues-softwares:~/Documents/Script$
/etc/nginx/nginx.conf
server {
listen 80;
server_name home.blues-softwares.nte www.home.blues-softwares.net;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name home.blues-softwares.net www.home.blues-softwares.net;
ssl_certificate /etc/nginx/ssl/home.blues-softwares.net.crt;
ssl_certificate_key /etc/nginx/ssl/home.blues-softwares.net.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
root /var/www/home.blues-softawers.net;
index index.html index.htm;
}
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
sendfile on;
keepalive_timeout 65;
# Paramètres SSL globaux
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-
SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-
RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
# Inclut les configurations des sites virtuels
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
qu'est ce que j'ai loupé ?
Jack Sparrow