Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NGINX - redirect from https to http without ssl certificate

Tags:

nginx

I'm setting up a new nginx box however I can't figure out why my nginx isn't starting when I use this:

    server {
    listen      443;
    server_name mysite.com; // https://mysite.com
    rewrite ^(.*)   https://mynewsite.com.com$1 permanent; // new site
}

Anyone help me out?

like image 403
Joe Avatar asked Jul 21 '10 11:07

Joe


People also ask

How do I redirect https to HTTP Nginx?

Nginx Redirect all HTTP traffic to HTTPS Here is a breakdown of the commands: Listen 80 : This instructs the system to catch all HTTP traffic on Port 80. Server_name _; : This will match any hostname. Return 301 : This tells the browser (and search engines) that this is a permanent redirect.

How do I enable https on Nginx only?

To set up an HTTPS server, in your nginx. conf file include the ssl parameter to the listen directive in the server block, then specify the locations of the server certificate and private key files: server { listen 443 ssl; server_name www.example.com; ssl_certificate www. example.com.


1 Answers

This is impossible to do. Redirecting from https to http itself is based on a successful https connection, which requires a certificate.

like image 171
Tres Avatar answered Sep 27 '22 19:09

Tres