Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to do http to https redirect for sickbeard using nginx 1.6.0 on Ubuntu 14.04 and it doesn't work.

Here's the config for sickbeard:

upstream sickbeard  {
  server localhost:8081;
}

server {
  listen *:80;         
  server_name sb.mydomain.com;
  server_tokens off;
  root /nowhere; 
  rewrite ^ https://$server_name$request_uri? permanent;
}

server {
  listen 443 ssl;
  server_name sb.mydomain.com;
  server_tokens off;

  ssl on;
  ssl_protocols       SSLv3 TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers         AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
  ssl_session_cache   shared:SSL:10m;
  ssl_session_timeout 10m;
  ssl_certificate      server.crt;
  ssl_certificate_key  server.key;

  location / {
    proxy_pass  http://sickbeard;
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header        Host            $host;
    proxy_set_header        X-Real-IP       $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

So https://sb.mydomain.com/home works, http://sb.mydomain.com/home doesn't (it times out).

Any ideas why?

Thanks!

share|improve this question

1 Answer 1

I managed to get it to work. I had to add the following line in /etc/hosts:

127.0.0.1    sb.mydomain.com    sb
share|improve this answer
    
Thanks for this. It helped me with my own config. –  Vasili Syrakis Apr 29 at 9:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.