Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx - docker - problem with adding add worker_connections. nginx - directive is not allowed here #27

Closed
amakko opened this issue Jun 16, 2020 · 1 comment

Comments

@amakko
Copy link

amakko commented Jun 16, 2020

Hi
How to add worker_connections to my nginx config?

worker_processes 1;

events {
  worker_connections 10240; # increase if you have lots of clients
}
http {

  upstream my-app {
    server web-prod: 8000;
  }

  server {
    listen 80;
    server_name my-app.com;
    client_max_body_size 4G;

    access_log off;

    gzip on;
    gzip_min_length 10240;
    gzip_comp_level 1;
    gzip_vary on;
    gzip_proxied expired no-cache no-store private auth;
    gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml application/atom+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;

    # allow the server to close connection on non responding client, this will free up memory
    reset_timedout_connection on;

    # request timed out -- default 60
    client_body_timeout 10;

    # if client stop responding, free up memory -- default 60
    send_timeout 2;

    # server will close connection after this time -- default 75
    keepalive_timeout 30;

    # number of requests client can make over keep-alive -- for testing environment
    keepalive_requests 100000;

    location / {
      proxy_pass http://my-app;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $host;
      proxy_redirect off;
    }

    location /staticfiles/ {
      alias /usr/src/app/my-app/staticfiles/;
      expires 365d;
    }
    location /mediafiles/ {
      alias /home/app/web/mediafiles/;
    }
  }
}`

error nginx
nginx: [emerg] "worker_processes" directive is not allowed here in /etc/nginx/conf.d/nginx.conf:1

I guess there is a problem with my dockerfile and configuration nginx files. I tried many configurations and I am looking for a problem on many pages but I can't find a solution right now. I will be grateful for the tips

@mjhea0
Copy link
Contributor

mjhea0 commented Jun 16, 2020

https://stackoverflow.com/a/62360968/1799408 is the answer

@mjhea0 mjhea0 closed this as completed Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants