Score:0

Nginx listening on 80 after removing server block

jp flag
Sid

I am trying to restrict http access to my webapp. It should only be accessed using https.

my nginx conf file looks like this:

server {
  listen                443 ssl;
  ssl_certificate       /home/ubuntu/certificate.crt;
  ssl_certificate_key   /home/ubuntu/private.key;

  server_name ec2-xx-xx-xx-xx.xx-xx-x.compute.amazonaws.com;
  
  # location blocks below ...
}

When I access my server using IP address and HTTP, it is redirecting users to https:// on chrome, but on firefox, it's redirecting to https://. I want to disable redirect from HTTP to HTTPS. How do I do that?

Update: Clearing browser cache resolved this. Can I restrict access to my server using EC2 DNS? I only have SSL for my IP.

Michael Hampton avatar
cz flag
You have not shown any nginx configuration containing a redirect. Why do you believe that this has anything to do with nginx?
Sid avatar
jp flag
Sid
So I had a redirect block from http to https but removed it after testing. It's still redirecting even though I removed that block.
Michael Hampton avatar
cz flag
Clear your browser cache.
Sid avatar
jp flag
Sid
Thank you, that was it!
Sid avatar
jp flag
Sid
Is it possible to prevent access to my server only using IP and not EC2 DNS? I need this because I only have SSL for my IP.
us flag
Please open a new question, and try to clarify it, the question above is difficult to understand.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.