[FEATURE] Documentation: Attach a "most optional" reverse proxy settings example
IngwiePhoenix opened this issue · 2 comments
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. ^^ )
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.
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;
}
}