502 on Nginx after start CSF - django

I've installed gunicorn, django and nginx as described in this tutorial.
I've developed a function in django that adds a user in my database and it works perfectly!!
Now I've installed CSF (Config Server Firewall) and if I run it csf -r, the same function for adding a user doesn't work.
I see, in the error log of Nginx, this raw:
*2014/06/25 10:11:04 [error] 5396#0: *19 upstream prematurely closed connection while reading response header from upstream, client: 79.35.50.121, server: [MY_SERVER_NAME], request: POST /django/registerClient HTTP/1.1, upstream: [MY_IP_SERVER]:8001/django/registerClient, host: [MY_IP_SERVER]*
I underline that the function work without star csf.
Can anyone can explain to me why I get this problem?

Related

Occasionally Bad Gateway (502) from nginx and jetty on aws after upgrading dropwizard

I'm running a jetty REST server on AWS - Elastic Beanstalk, with nginx.
The application is running using the Dropwizard framework.
Recently, I've upgraded Dropwizard from version 1.2.2 to 1.3.5.
Then, some of my integration tests started to fail occasionally with Bad Gateway response.
These are the sort of errors I see in nginx error.log:
2018/08/14 05:03:07 [error] 12897#0: *11330 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.30.xx.xx, server: , request: "POST /some_url HTTP/1.1", upstream: "http://127.0.0.1:8080/some_url", host: "some_host.local"
2018/08/14 07:37:02 [error] 18575#0: *13099 writev() failed (104: Connection reset by peer) while sending request to upstream, client: 10.30.xx.xx, server: , request: "POST /some_url HTTP/1.1", upstream: "http://127.0.0.1:8080/some_url", host: "some_hostname"
The Dropwizard upgrade changed the jetty version from 9.4.7.v20170914 to 9.4.11.v20180605.
Jersey client remained the same version: 2.25.1
It seems that there were some "Bad Gateway" before the upgrade, but their number increased significantly.
I cannot imagine right now why this upgrade should have cause this, so I'm open for your ideas.
The problem is discussed here: https://github.com/dropwizard/dropwizard/issues/2461
The suggested solutions are:
Use a stronger machine instance in EC2.
Manually increase the value of the configuration parameter "acceptQueueSize" to a higher value than the OS default (suggested: 256)

Capistrano 3/Puma/Nginx/EC2 deosn't work

I've used this tutorial for deploying rails app to aws http://www.sitepoint.com/deploy-your-rails-app-to-aws/
But when I try to open it in browser nginx says
2015/10/18 13:05:00 [crit] 11945#0: *1 connect() to unix:/home/deploy/app_name/shared/tmp/sockets/puma.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://unix:/home/deploy/app_name/shared/tmp/sockets/puma.sock:/", host: "localhost"
What could be the problem? I've re-checked all the steps - seems like everything is correct.
Pro-guys, could you please review this tutorial and let me know why I have this error?
Thanks!
the issue was in my app. I have ElasticSearch usage in my models and elastic search wasn't installed. After installing it puma server started successfully

Where is the uWSGI (error) log file when installing uWSGI using pip?

I'm trying to run my Django app using Nginx and uWSGI. When I try to go to
127.0.0.1:8001/media/media.png
Nginx properly shows the image, but when I go to
127.0.0.1:8000/CMS/users
Django is supposed to call a view. Instead, Nginx returns a 504 Gateway Time-out. When I view the Nginx error log, it says
*6 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 192.168.174.131, request: "GET /CMS/users HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "127.0.0.1:8000"
Does a uWSGI error log file exist? If yes, where can I find it? (I'm searching for it because I think it might help debug the issue).
Note: I installed uwsgi using pip.

nginx error while trying to serve django page

I'm new at server setup. I'm trying to set up an EC2 instance to serve a Django app through nginx. I'm able to run and connect to the Django app using
python managy.py runserver 0.0.0.0:8000
However, while trying to setup the nginx to serve Django, I get the following error:
2013/05/22 06:19:25 [crit] 10035#0: *8 connect() to
unix:///home/ubuntu/web/something.com/something_uwsgi.sock failed (2:
No such file or directory) while connecting to upstream, client:
50.156.16.40, server: jamsnap.com, request: "GET / HTTP/1.1", upstream:
"uwsgi://unix:///home/ubuntu/web/something.com/something_uwsgi.sock:",
host: "ec2.something.com"
Can anyone point me in the right direction? I'm at a loss right now.

502 error after adding application to a Django project running on nginx and gunicorn

I am trying to add an application to an existing Django project, but once I have done it I get a 502 error.The server is running Ubuntu. I don't think it has to do with the applications code because I got it running on the django development server. It goes away when I take out the app's name from settings.py and restart gunicorn.
Here's a part of the log
2011/07/15 01:24:45 [error] 16136#0: *75593 connect() failed (111: Connection refused) while connecting to upstream, client: 24.17.8.152, server: staging.site.org, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8020/", host: "staging.site.org"
Here's the nginx config file.
Nginx Config File
I'm not sure what other information is needed. Not sure where the gunicorn logs are located. My server admin skills are kind of lacking.
Nginx isn't able to connect to your backend (gunicorn) or gunicorn is refusing the connection. You provided no details about the configuration so that's all the help you'll get. You are correct that the application code has nothing to do with it. It's a configuration error on your part.