Skip to content

Commit

Permalink
fix(gateway): fix "worker_connections are not enough" error
Browse files Browse the repository at this point in the history
Fix the issue of inadequate distribution of client connections
among worker processes by enabling the `reuseport` option.
This enhancement allows the kernel to efficiently distribute
incoming connections across multiple worker processes, resolving
the 'worker_connections are not enough' error.
  • Loading branch information
gustavosbarreto committed Dec 18, 2023
1 parent e312d2b commit 9b87c3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gateway/conf.d/shellhub.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {
{{ if and (bool (env.Getenv "SHELLHUB_AUTO_SSL")) (ne (env.Getenv "SHELLHUB_ENV") "development") -}}
listen 443 ssl{{ if bool (env.Getenv "SHELLHUB_PROXY") }} proxy_protocol{{ end }};
listen 443 reuseport ssl{{ if bool (env.Getenv "SHELLHUB_PROXY") }} proxy_protocol{{ end }};
ssl_certificate /etc/letsencrypt/live/{{ env.Getenv "SHELLHUB_DOMAIN" }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ env.Getenv "SHELLHUB_DOMAIN" }}/privkey.pem;

Expand All @@ -15,7 +15,7 @@ server {

ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
{{ else -}}
listen 80{{ if bool (env.Getenv "SHELLHUB_PROXY") }} proxy_protocol{{ end }};
listen 80 reuseport{{ if bool (env.Getenv "SHELLHUB_PROXY") }} proxy_protocol{{ end }};
{{- end }}
{{ if bool (env.Getenv "SHELLHUB_PROXY") }}
set_real_ip_from ::/0;
Expand Down

0 comments on commit 9b87c3c

Please sign in to comment.