I am using following Nginx configuration block
server {
listen 80;
server_name MyDomain.co.uk www.MyDomain.co.uk *.MyDomain.co.uk;
return 301 https://www.MyDomain.co.uk$request_uri;
}
server {
listen 443;
server_name MyDomain.co.uk www.MyDomain.co.uk *.MyDomain.co.uk;
access_log /var/www/vhosts/MyDomain.co.uk/logs/access.log;
error_log /var/www/vhosts/MyDomain.co.uk/logs/error.log;
root /var/www/vhosts/MyDomain.co.uk/httpdocs;
ssl on;
ssl_certificate /etc/nginx/ssl/MyDomain.co.uk.crt;
ssl_certificate_key /etc/nginx/ssl/MyDomain.co.uk.key;
ssl_protocols TLSv1.1 TLSv1.2;
...
...
...
}
this is to achieve that all traffic which comes to my website via following
http://MyDomain.co.uk
http://www.MyDomain.co.uk
https://MyDomain.co.uk
should always be forwarded to https://www.MyDomain.co.uk
but I am having 2 issues
Everything is fine but
https://MyDomain.co.uk
never forwards tohttps://www.MyDomain.co.uk
not sure why but could it be due to fact that my certificate is only valid forwww.MyDomain.co.uk
and not for domainMyDomain.co.uk
? but I have seen other posts in this forums where users are achieving this if I am not wrong?After making above change of Nginx block configuration to forward non-https to https and non-www to www for some reason my Magento back-end is not working, I can login to backend fine but when I try to do anything like flushing the cache or any other function it always says following and nothing is done
Could it be because most of the settings of Nginx is under SSL block?