Question
Nginx HTTPS Redirect Loop with no fix
Hi all,
I set up ssl certificate for my website recently and it was working but i messed up somewhere in the config.
I’ve replaced all my actual website link with *******.com
I run Ubuntu 16.04
Nginx 1.10
PHP7
MySql
Every time i visit my website on chrome, i get the error:
This page isn’t working
*******.com redirected you too many times.
Try clearing your cookies.
ERRTOOMANY_REDIRECTS
My config file is as follows:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name *******.com;
return 301 $scheme://*******.com$request_uri;
root /var/www/html;
index index.html index.htm;
location /
{
try_files $uri $uri/ /index.php?$args;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/config/php/fastcgi_params;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name *******.com;
root /var/www/html;
index index.html index.htm;
ssl on;
ssl_certificate /etc/ssl/*******.com.certchain.crt;
ssl_certificate_key /etc/ssl/*******.com.key;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 60m;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DHE+AES128:!ADH:!AECDH:!MD5;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/ssl/certs/trustchain.crt;
resolver 8.8.8.8 8.8.4.4;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
}
I’ve tried many solutions but havent come up with anything.
Plsease help me out!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×