Why should it redirect to https when you open http://www.domain.com/admin ? I don't see any "location /admin" block that would do that.
If you want https only for /admin create a block like this:
location /admin {
return 301 https://www.domain.com/admin;
}
Better: If you have the ressources, why not redirect all traffic to https?
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name www.domain.com domain.com;
[rest of your config]
If you want https only for /admin create a block like this:
location /admin {
return 301 https://www.domain.com/admin;
}
Better: If you have the ressources, why not redirect all traffic to https?
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name www.domain.com domain.com;
[rest of your config]