• Hi there, i recently set up a wordpress blog and i decided to enable https for logins and admin pages, so i followed a blog post here >> https://www.whattheken.com/ on doing so with nginx rewrite rules.

    once i enabled this config my problems start, when i try to access any of the pages that should be served as https they are downloaded as a file instead of being rendered, and when i try and access the pages that should be shown as normal http i just get an error in the browser about being in a redirect loop. now i can’t get into my admin pages or anywhere by my site frontpage. my site conf is this

    # Upstream to abstract backend connection(s) for php 
    
    	upstream php {
    		server unix:/var/run/php5-fpm.sock;
    	} 
    
    	server {
    	## Your only path reference.
    	root /srv/www/wordpress/public_html;
    	listen 		80;
    
    	## Your website name goes here. Change to domain.ltd in VPS 
    
    	server_name www.mysite.com mysite.com;
    
    	access_log /srv/www/wordpress/logs/access.log;
    	error_log /srv/www/wordpress/logs/error.log; 
    
    	## This should be in your http block and if it is, it's not needed here. 
    
    	index index.php;
    
    	## redirect login and admin pages to https
    	location ~ /wp-(:?admin|login) {
       		 return 301 https://$host$request_uri;
      	}
    
    	location = /favicon.ico {
    		log_not_found off;
    		access_log off;
    	} 
    
    	location = /robots.txt {
    		allow all;
    		log_not_found off;
    		access_log off;
    	} 
    
    	location / {
    		# This is cool because no php is touched for static content
    		try_files $uri $uri/ /index.php;
    	} 
    
    	location ~ \.php$ {
    		#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    		include fastcgi_params;
    		fastcgi_intercept_errors on;
    		fastcgi_pass php;
    	} 
    
    	location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    		expires max;
    		log_not_found off;
    	} 
    
    	location /classless {
        		auth_basic "Admin Login";
            	auth_basic_user_file /etc/nginx/pma_pass;
    		allow 212.159.59.163; #my ip address
    		deny all;
    	}
    }
    
    	server {
    	listen 443;
    
    	server_name mysite.com;
    
    	root /srv/www/wordpress/public_html;
    
    	index	index.php;
    
    	# Turn on SSL and SSL specific settings.
    	ssl on;
    
    	# SSL certificate and key location.
    	ssl_certificate /etc/ssl/certs/mysite.crt;
    	ssl_certificate_key /etc/ssl/private/mysite.key;
    	ssl_ciphers 'kEECDH+ECDSA+AES128 kEECDH+ECDSA+AES256 kEECDH+AES128 kEECDH+AES256 kEDH+AES128 kEDH+AES256 DES-CBC3-SHA +SHA !aNULL !eNULL !LOW !MD5 !EXP !DSS !PSK !SRP !kECDH !CAMELLIA !RC4 !SEED';
    	ssl_prefer_server_ciphers	on;
    	ssl_protocols	TLSv1 TLSv1.1 TLSv1.2;
    	add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
    	ssl_session_cache   shared:SSL:10m;
    	ssl_session_timeout 10m;
    	keepalive_timeout   70;
    
    	# Redirect all other requests to HTTP.
    	location / {
    		return 301 https://$host$request_uri;
      	}
    
    	# Match wp-admin, wp-login, wp-includes, and wp-content.
    	location ~ /wp-(admin|login|includes|content) {
    		try_files $uri $uri/ \1/index.php?$args;
     	}
    
    	location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
    		rewrite ^ https://$host$request_uri permanent;
    	}
    
    	location ~ \.php$ {
                    #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                    include fastcgi_params;
                    fastcgi_intercept_errors on;
                    fastcgi_pass php;
            }
    
    }

    is anything popping out as to why i’m having this issue? afaik my ssl setup is working fine as checked by https://www.ssllabs.com/ssltest/ gives an A rating

    any help would be much appreciated
    thanks in advance

Viewing 1 replies (of 1 total)
  • Thread Starter happyharrysco1

    (@happyharrysco1)

    can anyone give my an idea of where to start looking to fix this, as i can’t access anything but my sites front page, also none of my links open their page and i can’t get into the admin panel either.

    any help would be much appreciated
    thanks

Viewing 1 replies (of 1 total)
  • The topic ‘https problems and page redirects’ is closed to new replies.