limit_conn_zone Nginx Unknow error - nginx

What am I doing wrong here?
http {
limit_conn_zone $binary_remote_addr zone=one:63m;
server {
location /downloads/ {
limit_conn one 10;}
[root#batman1 ~]# service nginx configtest
nginx: [emerg] the size 66060288 of shared memory zone "one" conflicts with already declared size 0 in /etc/nginx/nginx.conf:60
nginx: configuration file /etc/nginx/nginx.conf test failed

Thx!
I resolve my miss configuration.
Only changing of position my include to the final.
On nginx.conf I put the directive limit_conn_zone after the include.
and that cause the error.
Moving the include directive is all solve.

Related

Setting up mongodb behind nginx

I am trying to setup mongodb behind nginx, and below is the configuration I used. But I keep getting the following error when I reload nginx. Any help is appreciated.
nginx: [emerg] no port in upstream "stream_mondo_backend" in /etc/nginx/nginx.conf:15
You have a trivial mistype. stream_monGo_backend in upstream section and stream_monDo_backend in proxy_pass directive.

Nginx unknown directive "proxy_pass"

I'm having a problem with nginx configuration.
When I set the configuration like this:
server {
server_name redmine;
listen 80;
location / {
proxy_pass http://172.16.0.70:33000;
}
}
I get this error nginx: [emerg] unknown directive "proxy_pass".
My nginx version is nginx/1.8.0.
Someone know what i'm missing or what i'm doing wrong? Thanks.
Seems that module ngx_http_proxy_module is not installed
Run nginx -V to view how nginx is configured. If it is configured with option --without-http_proxy_module than nginx doesn't have proxy module and should be recompiled.

uWSGI nginx error : connect() failed (111: Connection refused) while connecting to upstream

I'm experiencing 502 gateway errors when accessing my IP on nginx(http://52.xx.xx.xx/), the logs simply says this:
2015/09/18 13:03:37 [error] 32636#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: xx.xx.xx.xx, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "xx.xx.xx.xx"
my nginx.conf file
# the upstream component nginx needs to connect to
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8000; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name xx.xx.xx.xx; # substitute your machine's IP address or FQDN
charset utf-8;
access_log /home/ubuntu/test_django/nginx_access.log;
error_log /home/ubuntu/test_django/nginx_error.log;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/ubuntu/test_django/static/media/; # your Django project's media files - amend as required
}
location /static {
alias /home/ubuntu/test_django/static/; # your Django project's static files - amend as required
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/ubuntu/test_django/uwsgi_params; # the uwsgi_params file you installed
}
}
Is there anything wrong with nginx.conf file.....if i use default conf then it is working.
I resolved it by changing the socket configuration in uwsgi.ini
from socket = 127.0.0.1:3031, to socket = :3031. I was facing this issue when I ran nginx in one Docker container and uWSGI in another. If you are using command line to start uWSGI then do uwsgi --socket :3031.
Hope this helps someone stuck with the same issue, during deployment of a Django application using Docker.
change this address:
include /home/ubuntu/test_django/uwsgi_params;
to
include /etc/nginx/uwsgi_params;
I ran into this issue when setting up the env by nginx + gunicorn and solve it by
adding '*' to ALLOWED_HOSTS or your specific domain.
In my case with a debian server it worked moving:
include /etc/nginx/uwsgi_params;
In the location tag in my nginx server config file, like this:
location /sistema {
include /etc/nginx/uwsgi_params;
uwsgi_pass unix://path/sistema.sock;
}
Also, check you have the following packages installed:
uwsgi-plugin-python
pip3 install uWSGI did the trick for me :D

Nginx and upstream : configuration failed

I try to test load balancer with nginx so I add upstream like the documentation exemple. But when I try to reload nginx to refresh the configuration, the refresh fail.
I just added upstream bloc, if I remove it all work
file : /etc/nginx/sites-available/default
upstream backend {
server webserver1:80;
server webserver2:80;
}
server {
listen 80;
listen [::]:80;
server_name www.interceptlocalcall.io interceptlocalcall.io;
location /users {
proxy_pass http://127.0.0.10:18000;
}
...
when I reload with the upstream block :
[FAIL] Reloading nginx configuration: nginx failed!
Nginx version :
nginx version: nginx/1.6.2
I see anything about this error, so I think I just miss something, perhaps in the install ?
If you have any idea thanks.
Please test your configuration by running $ nginx -c /etc/nginx/nginx.conf -t — it will tell you more detailed information about what's wrong with your configuration.
These messages also written to global error.log file (not one you define for servers but one defined in http section), usually located in /var/log/nginx/error.log.

Reloading nginx configuration: nginx failed

Why does not the nginx rewrite?
"[FAIL] Reloading nginx configuration: nginx failed!"
rewrite ^/([0-9]+)/test.php http://domain.com:$1/;test.php last;
Destination address:
http://domain.com:1234/;test.php
When you use this syntax you will always have error
nginx: [emerg] unknown directive "test.php"
nginx: configuration file /etc/nginx/nginx.conf test failed
all text after
http://domain.com:$1/;
this is new directive.
In your example test.php == directive, the same as server_tokens or keepalive_timeout.
So, if you want that your rewrite will be correct use this syntax
rewrite '^/([0-9]+)/test.php' 'http://domain.com:$1/;test.php' last;

Resources