Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

485
Views
Using SSL with nginx and Ubuntu on AWS EC2 is not working

I'm struggling with setting up a SSL for my EC2 instance on Ubuntu, I did it without any problems on Amazon AMI, but I have some problems with Ubuntu:

  1. ✅ Added 443 port for SSL in Security groups
  2. ✅ Generated letsencrypt key via certbot
  3. ✅ Redirected http request to the https in nginx.conf
  4. ✅ Restarted nginx

And I have timeout when I'm accessing my site via https, could help me with debugging this issue?

Here is my nginx.conf:

server {
  listen 80;
  listen [::]:80;
  server_name mydomain.com;
  return 301 https://$server_name$request_uri;
}

server {
  listen 443 ssl;
  listen [::]:443 ssl;
  server_name mydomain.com;
  root /home/ubuntu/myproject;

  add_header Strict-Transport-Security "max-age=15768000";
  ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;

  include /etc/letsencrypt/options-ssl-nginx.conf;
  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

  location / {
    proxy_pass http://127.0.0.1:8000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forward-Proto http;
    proxy_set_header X-Nginx-Proxy true;
    proxy_redirect off;
  }
}

Note: Everything is working via HTTP when I'm disabling redirect in nginx.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As you said this configuration was ok, I've terminated an instance and reinstall nginx and works properly right now.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!