server {
    listen       80;
    server_name  www.izomega.ru izomega.ru;
    rewrite        ^ http://omega-press.ru? permanent;
}

server {
    listen       80;
    server_name  www.ifolica.ru ifolica.ru;
    rewrite        ^ https://ifolica.ru? permanent;
}

server {
    listen       443 ssl;
    server_name  www.ifolica.ru;
    rewrite        ^ https://ifolica.ru? permanent;
    ssl         on;
    ssl_certificate      /home/ubuntu/projects/ifolica/ssl_cert/if2.crt;
    ssl_certificate_key  /home/ubuntu/projects/ifolica/ssl_cert/if2.key;
    access_log  off;
    error_log off;
}

upstream ifolica {
    server unix:/home/ubuntu/projects/ifolica/run/gunicorn.sock fail_timeout=0;
}



server {
    listen      443 ssl;
    server_name ifolica.ru;
    charset     utf-8;
    client_max_body_size 75M;
    ssl         on;
    ssl_certificate      /home/ubuntu/projects/ifolica/ssl_cert/if2.crt;
    ssl_certificate_key  /home/ubuntu/projects/ifolica/ssl_cert/if2.key;
    location /media  {
        alias /home/ubuntu/projects/ifolica/data/media;
    }

    location /static {
        alias /home/ubuntu/projects/ifolica/data/static;
    }

    location / {
      proxy_pass         http://ifolica;
      proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
    }
}
