Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

[FEATURE] Documentation: Attach a "most optional" reverse proxy settings example #111

Open
IngwiePhoenix opened this issue Nov 22, 2020 · 2 comments

Comments

@IngwiePhoenix
Copy link

IngwiePhoenix commented Nov 22, 2020

Is your feature request related to a problem? Please describe.
I don't know how many would do it that way, but I run neko behind a NGINX reverse proxy. Unfortunately, I don't know if my settings are apropriate, considering I keep getting disconnects every few moments. My guess is that my revproxy settings aren't proper.

Describe the solution you'd like
There might be people who don't have a lot of experience with NGINX and friends - adding a piece of documentary with some recommended reverse proxy settings would be helpful for those.

Additional context
Here's mine:

server {
  listen *:80;
  listen [::]:80;
  server_name (...);

  # enforce https
  location / {
    return 301 https://$server_name$request_uri;
  }
}

server {
  listen *:443 ssl;
  listen [::]:443 ssl;
  server_name (...);
  keepalive_timeout 1000;

  ssl_certificate (...); # managed by Certbot
  ssl_certificate_key (...); # managed by Certbot

  ssl_session_timeout 5m;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:AES256+EDH';
  ssl_prefer_server_ciphers on;
  ssl_dhparam /etc/nginx/dh4096.pem;
  ssl_stapling off;
  #ssl_stapling_verify on;

  # Add headers to serve security related headers
  # Before enabling Strict-Transport-Security headers please read into this topic first.
  add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
  add_header X-Content-Type-Options nosniff;
  add_header X-Frame-Options "SAMEORIGIN";
  add_header X-XSS-Protection "1; mode=block";
  add_header X-Robots-Tag none;
  add_header X-Download-Options noopen;
  add_header X-Permitted-Cross-Domain-Policies none;

  client_max_body_size 0;
  gzip off;

  location / {
        proxy_pass http://127.0.0.1:9090;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_buffering off;
        client_max_body_size 0;
        proxy_read_timeout 36000s;
        proxy_redirect off;
    }

    location /ws {
        proxy_pass http://127.0.0.1:9090;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;
    }
}

(The (...) are just me removing information I'd rather not share. ^^ )

@m1k1o
Copy link
Contributor

m1k1o commented Nov 23, 2020

We already have config for apache. https://github.com/nurdism/neko/blob/master/docs/apache-proxypass-config.md

Feel free to create PR and add nginx config to docs.

@GigaFyde
Copy link
Contributor

GigaFyde commented Dec 10, 2020

Here's the nginx config I use

server {
        listen 443 ssl http2;
        server_name example.com;
        location / {
                        proxy_pass http://127.0.0.1:8082;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection "upgrade";
                        proxy_read_timeout 86400;
                        proxy_set_header Host $host;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Forwarded-For $remote_addr;
                        proxy_set_header X-Forwarded-Host $host;
                        proxy_set_header X-Forwarded-Port $server_port;
                        proxy_set_header X-Forwarded-Protocol $scheme;

        }
  }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants