Hello,
I try to force SSL redirect on my website, but I’m getting a
ERR_TOO_MANY_REDIRECTS.
I can’t figure what’s wrong, here is my vhost .conf file :
server {
listen *:80;
listen *:443 ssl;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /var/www/clients/client2/web1/ssl/domain.tld.crt;
ssl_certificate_key
/var/www/clients/client2/web1/ssl/domain.tld.key;
Disables all weak ciphers
ssl_ciphers
“ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4”;
ssl_prefer_server_ciphers on;
server_name web-plus.pro www.web-plus.pro;
rewrite ^ https://$server_name$request_uri? permanent;
root /var/www/domain.tld/web;
index index.html index.htm index.php index.cgi index.pl
index.xhtml;
location ~ \.shtml$ { ssi on; }
error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
recursive_error_pages on;
location = /error/400.html {
internal;
}
location = /error/401.html {
internal;
}
location = /error/403.html {
internal;
}
location = /error/404.html {
internal;
}
location = /error/405.html {
internal;
}
location = /error/500.html {
internal;
}
location = /error/502.html {
internal;
}
location = /error/503.html {
internal;
}
error_log /var/log/ispconfig/httpd/domain.tld/error.log;
access_log /var/log/ispconfig/httpd/domain.tld/access.log
combined;
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location /stats/ {
index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file
/var/www/clients/client2/web1/web/stats/.htpasswd_stats;
}
location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}
location ~ \.php$ {
try_files /8861c6a67e54f5712a3f7875c91adaf9.htm @php;
}
location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web1.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
location /cgi-bin/ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
root /var/www/clients/client2/web1;
gzip off;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
pagespeed on;
pagespeed RewriteLevel PassThrough;
pagespeed EnableFilters
inline_css,inline_javascript,combine_css,extend_cache,rewrite_images;
pagespeed EnableFilters rewrite_css,rewrite_javascript;
pagespeed EnableFilters add_head,inline_import_to_link;
location /blog {
try_files $uri $uri/ /blog/index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/ngx_pagespeed_static/" {
}
location ~ "^/ngx_pagespeed_beacon$" {
}
location /ngx_pagespeed_statistics {
allow 127.0.0.1; deny all;
}
location /ngx_pagespeed_global_statistics {
allow 127.0.0.1; deny all;
}
location /ngx_pagespeed_message {
allow 127.0.0.1; deny all;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|ttf|otf|svg|webp)$ {
expires 365d;
}
}
Thanks in advance for your help !