tf2012
asked on
SSL Plesk nginx probelm
I have a site www.fakesite.com and I have an SSL cert installed and I can navigate to https://www.fakesite.com no problem. But I'm trying to create an nginx directive that will automatically redirect non-ssl visitors to https://www.fakesite.com
This didn't seem to work, can someone show me how to do this?
if ($server_port = 80) {
rewrite ^ https://$host$request_uri permanent;
}
This didn't seem to work, can someone show me how to do this?
if ($server_port = 80) {
rewrite ^ https://$host$request_uri permanent;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Each site can have one embedded location of same name.
ASKER
ok thanks
ASKER
location / {
rewrite ^(.*)$ https://www.fakesite.com/$1 redirect;
}
and I'm getting this error:
Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/fak
line 9 corresponds to where I made this entry. The rest of the config contains page redirects which don't throw errors.
Any ideas what the problem is?