Très bien, merci !
Pour ce qui est de Let’s Encrypt, c’est ce que j’utilise. Quant à dot.tk j’irai voir, je ne connaissais pas.
Et voici donc ma conf, qui pour le moment redirige un site du port 80 vers le port 443 et possède un site sur le port 90 sans redirection, étant donné que je n’arrive pas à activer le SSL avec redirection sur ce dernier site, comme je voudrais :
server {
listen 90;
server_name blah.com;
root /var/www/html;
index index.html index.htm index.php;
access_log on;
error_log /var/www/html/log/http.error;
client_max_body_size 100M;
server_tokens off;
add_header Cache-Control "public";
location / {
try_files $uri $uri/ /index.html /index.php;
}
location ~ ^/tmp/(.*)$ {
deny all;
}
location ~ ^/log/(.*)$ {
deny all;
}
location ~ ^/backup/(.*)$ {
deny all;
}
location ~ \.sql$ {
deny all;
}
location ~ \.tar$ {
deny all;
}
location ~ \.gz$ {
deny all;
}
location ~ ^/(.*)ini$ {
deny all;
}
location ~ ^/core/config/version$ {
deny all;
}
location ~ ^(.+?\.php)(/.*)?$ {
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
try_files $uri =404;
fastcgi_param SCRIPT_FILENAME $document_root$1;
fastcgi_param PATH_INFO $2;
fastcgi_pass 127.0.0.1:9000; #unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_read_timeout 300;
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
}
}
server {
listen 80 default;
server_name blah.com;
## redirect http to https ##
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
server_name blah.com;
root /var/www/blah;
index index.html;
ssl_certificate /etc/nginx/blah.cert;
ssl_certificate_key /etc/nginx/blah.key;
listen 443 ssl;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_dhparam /etc/nginx/dhparam-blah.pem;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/trustchain-blah.cert;
resolver 8.8.8.8 8.8.4.4;
add_header Strict-Transport-Security "max-age=31536000 always";
}
Voilà, merci et déolé pour le formatage de la conf, je n’arrive pas à trouver comment faire sur ce forum !