NGINX + uWSGI Connection Reset by Peer

make sure to consume your post data in your application for example if you have a Django/python application def my_view(request): # ensure to read the post data, even if you don’t need it # without this you get a: failed (104: Connection reset by peer) data = request.DATA return HttpResponse(“Hello World”) Some details: https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html

uWSGI can not load libssl.1.0.0.dylib

MacPorts usually install softwares into /opt/local/, but brew will install softwares into /usr/local/. It seems that my uwsgi is looking for the libssl.1.0.0.dylib in /usr/local/lib, so I use brew to install openssl and relink it: brew install –upgrade openssl brew unlink openssl && brew link openssl –force

X-Forwarded-Proto and Flask

You are missing the ProxyFix() middleware component. See the Flask Proxy Setups documentation. There is no need to subclass anything; simply add this middleware component to your WSGI stack: # Werkzeug 0.15 and newer from werkzeug.middleware.proxy_fix import ProxyFix from flask import Flask app = Flask(__name__) app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1) If you have Flask installed, you … Read more

Rebuild uwsgi with pcre support

pip install uwsgi -I Won’t recompile the uwsgi binary, it just reinstalls the python egg. You need to rebuild the uwsgi binary with the pcre libraries. sudo apt-get install libpcre3 libpcre3-dev I think the easiest way is just to uninstall uwsgi and then run the pip installer again. pip uninstall uwsgi sudo apt-get remove uwsgi … Read more

Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding, when trying to start uwsgi

I see your PYTHONHOME is set to PYTHONHOME = ‘/home/env3/educ’. Try to check if it is really there. The solution for me was to remove the PYTHONHOME environment variable. For you, it can be just that, or setting that variable to another value. This worked on Windows, and would work on Linux for sure. If … Read more

Why is PyMongo 3 giving ServerSelectionTimeoutError?

We’re investigating this problem, tracked in PYTHON-961. You may be able to work around the issue by passing connect=False when creating instances of MongoClient. That defers background connection until the first database operation is attempted, avoiding what I suspect is a race condition between spin up of MongoClient’s monitor thread and multiprocess forking.

uWSGI request timeout in Python

You’re propably looking for the harakiri parameter – if request takes longer than specified harakiri time (in seconds), the request will be dropped and the corresponding worker recycled. For standalone uwsgi (ini config): [uwsgi] http = 0.0.0.0:80 harakiri = 30 … If you have nginx proxy before uwsgi you have to increase timeout as well: … Read more