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?



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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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