Unable to rewrite URL in Nginx when using SSL on non-standard ports

view full story

http://serverfault.com – I am using a test instance of my application on non-standard ports and would like to use nginx to redirect all incoming http requests to https Here is my nginx config: I tried the above but Cant seem to get it working : please see below ...... include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { listen 9000; server_name iossapp1.com; if ($scheme = 'http') { rewrite ^ https://$server_name:9443$request_uri? permanent; } } ssl_certificate (HowTos)