sergiotapia / magnetissimo

Web application that indexes all popular torrent sites, and saves it to the local database.
MIT License
2.98k stars 187 forks source link

Nginx vhost #128

Closed m333w closed 5 years ago

m333w commented 5 years ago

Hi all,

I am trying to get magnetissimo working with nginx, actualy i got an error 525, here is my magnetissimo.conf :

server {
  listen 80;
  server_name magnetissimo.domain.tld;
  return 301 https://magnetissimo.domain.tld$request_uri;
}

server {
    listen 443;
    server_name magnetissimo.domain.tld;

    access_log /var/log/nginx/magnetissimo.access.log;
    error_log /var/log/nginx/magnetissimo.error.log;

    ssl_certificate /etc/nginx/ssl/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/privkey.pem;

  location / {
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   Host      $http_host;
        proxy_pass         http://localhost:4000;
        proxy_intercept_errors on;
    }
}

In my magnetissimo.acces.log i've got :

ip - - [27/Mar/2019:18:17:15 +0000] "\x16\x03\x01\x02\x00\x01\x00\x01\xFC\x03\x03\xD36\x86\x08Sl\x8Dt\xE5Un.\xE9\x5Ck\xB1\x18\x96\xFD8\x05\x93\xA7\xA6\xF8\x9C\x81!9\x1C\xC6\xA9 Z\xD6\x95m\x8D\x90\xEA\xEF\xE6\x8B\x84\xE6-\x84['W6\x17]@\xD5\x82R \xDF\x81Y82Z\xEF\x00\x18\x13\x01\x13\x02\x13\x03\xC0+\xC0/\xC0\x13\x00\x9C\x00/\xC0,\xC0(\x005\x00" 400 182 "-" "-"
ip - - [27/Mar/2019:18:17:16 +0000] "\x16\x03\x01\x00\xFF\x01\x00\x00\xFB\x03\x03\x18\xC4(e\x12\xB2L\x05\x891\xBD\x10\xDE\xD6\xC3lb+\x175,!\xE9K\xB3\x95]4\xA4\xC8:\xF3 \xDD\x8C\x95x\xC58/\x08\x12\x10\x1D=\xFA_\xC4;\x07xkR\xE3\xD9\xEF\x85,o\xAA\x11\x9CP@\xA8\x00\x18\x13\x01\x13\x02\x13\x03\xC0+\xC0/\xC0\x13\x00\x9C\x00/\xC0,\xC0(\x005\x00" 400 182 "-" "-"
ip - - [27/Mar/2019:18:17:30 +0000] "\x16\x03\x01\x00\xFF\x01\x00\x00\xFB\x03\x03#\x05\x03\xED\x01\x88\xC1>\x5C\xF4\xAD\xCB\xB0\x99!ph\xAB\x8C\xF6\x8C\x06H\x93\xE8\xB8Q\x94\xAC\x87\xDA\x18 \xE45-`F\xC5\xD6\xD2\x8B" 400 182 "-" "-"
ip - - [27/Mar/2019:18:17:34 +0000] "\x16\x03\x01\x00\xFF\x01\x00\x00\xFB\x03\x03" 400 182 "-" "-"
ip - - [27/Mar/2019:18:17:36 +0000] "\x16\x03\x01\x00\xFF\x01\x00\x00\xFB\x03\x03\xA0\x1F\x9B\x08\xE9\xD2[\xED+r\xF6G\xE4\xD5N\xBE(\x06~\xE5i\x00\xA2!\xF7\xA4P" 400 182 "-" "-"
ip - - [27/Mar/2019:18:22:32 +0000] "\x16\x03\x01\x00\xFF\x01\x00\x00\xFB\x03\x03[\x8CE\xFD\x7F\x80:\xD3\x15\xE5<\xB5\xA1M\x15P\x10c@\x08\xEC\xB0\xD5\x10\x97q\x0F\x03\x8FE\xE1\x1C \xAF\xBBs\xFF\x8FZ\x99\x06VeMM\xBD\xD7nK\x9EbZ6\xF3\xFF\xAD\xED\xE0\x9E=\xF0\x00\xDC\x22T\x00\x18\x13\x01\x13\x02\x13\x03\xC0+\xC0/\xC0\x13\x00\x9C\x00/\xC0,\xC0(\x005\x00" 400 182 "-" "-"

Does someone can help me to get magnetissimo working with nginx ?

Best regards.

skwerlman commented 5 years ago

Error 525 is a cloudflare error meaning your SSL handshake failed. My guess would be that you're missing ssl in your listen directive. it should read listen 443 ssl;. either way tho, this is an nginx-specific problem, not a problem in magnetissimo

m333w commented 5 years ago

Hi @skwerlman :)

Yeah, it whas my vhost the problem. I am able to run magnetissimo behind nginx with this vhost :

server {
  listen 80;
  server_name magnetissimo.domain.tld;
  return 301 https://magnetissimo.domain.tld$request_uri;
}

server {
    listen 443 ssl http2;
    server_name magnetissimo.domain.tld;

    access_log /var/log/nginx/magnetissimo.access.log;
    error_log /var/log/nginx/magnetissimo.error.log;

    ssl_certificate /etc/nginx/ssl/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/privkey.pem;

  location / {
    proxy_pass http://127.0.0.1:4000;
    proxy_redirect      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;
    }
}