52
votes
Why do I need Nginx and something like Gunicorn?
I liked this explanation in its simplicity:
Nginx will face the outside world. It will serve media files (images,
CSS, etc) directly from the file system. However, it can't talk
directly to ...
30
votes
Accepted
Wiring uWSGI to work with Django and nginx on Ubuntu 16.04
The first modification needed is to the /etc/uwsgi/sites/firstsite.ini file. The only change needed is replacing the permissions from 664 to 666. The script would look like this:
[uwsgi]
project = ...
16
votes
Accepted
WSGI : Truncated or oversized response headers received from daemon process
The cause of the problem was numpy.
Python C extension modules, like numpy, are known to cause timeouts when used under mod_wsgi.
Source : Answer by Sean F on Timeout when reading response ...
10
votes
Accepted
Nginx - connect() failed (111: Connection refused) while connecting to upstream
Could this be because your system is dual-stack, but your upstream is IPv4 only?
It looks as if localhost is resolving to [::1], which depending on your upstream might be the problem in and of itself....
10
votes
Accepted
Using Nginx to Block Connections that aren't addressed to my domain
It seems like your only virtual host is the one with default_server attribute. It means that if no matching virtual host is found, that block is used to serve the request.
To properly handle your case,...
9
votes
Accepted
Docker cannot access Webserver on host
For anyone stumbling upon this, you have to run the django server on 0.0.0.0:8000 inside the docker container, simply adding python django-admin runserver 0.0.0.0:8000 in my startup.sh fixed this for ...
9
votes
Accepted
Invalid HTTP_HOST header. The domain name provided is not valid according to RFC 1034/1035
The problem is that you have caused the Host header to be included twice.
proxy_set_header Host $host;
include proxy_params;
Looking at the proxy_params file will show you that it was ...
8
votes
Accepted
Cron job running a Django Python command through a virtual environment not working
There are a couple of ways to solve this:
First, it doesn't work because /bin/sh is the shell cron uses to run commands, but /bin/sh doesn't support source. So the quick fix is to set SHELL=/bin/bash ...
7
votes
WSGI : Truncated or oversized response headers received from daemon process
As others have mentioned, this is caused by the process crashing for a number of potential reasons. One reason being that some Python dependency isn't thread safe.
If that's the problem, one work ...
7
votes
Running single web app in server - why not using root?
There is nothing technically stopping you to do this. However in all respects it is a terrible idea.
The idea of running applications as non privileged users is not related to having one or multiple ...
7
votes
Accepted
Django 2.1 deployment on centos 7 with apache, mod_wsgi, python3 venv
I got everything to work. Here are the full steps:
yum install epel-release centos-release-scl
yum install python36 python36-devel httpd httpd-devel rh-python36-mod_wsgi`
Check if rh-python36-...
7
votes
Accepted
Error: could not determine PostgreSQL version from '11.7'
Error: could not determine PostgreSQL version from '11.7'
Known bug for psycopg2<=2.6.2. Try upgrading by editing its requirements.txt and changing psycopg2==2.6.0 to psycopg2==2.7.
5
votes
Accepted
Risks of using django manage.py runserver for production in a small scale server, for internal use?
From the manage.py documentation:
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone
through security audits or performance tests. (And that’s how it’s
gonna stay.
That's all you ...
5
votes
Sending emails via django does not work on Gunicorn / NGinx`
The port number (EMAIL_PORT = 443) you are using to connect to smtp host is wrong. It won't ever work. TCP Port 443 is reserved for HTTPS. Please try using Port 465 (SSL required) or Port 587 (TLS ...
5
votes
Accepted
Redirecting from www to no www in nginx reverse proxy
The preferred setup for a web server handling http://example.com, https://example.com, http://www.example.com and https://www.example.com is the following when the example.com domain and https are ...
5
votes
Django App Public IP Works but `400 Bad Request Error` when A Record Update
I figured out a resolution. It does appear that using the public IP is acceptable, but I failed to add my domain name both to the ALLOWED_HOSTS file and to my nginx configuration.
Doing the ...
5
votes
What is the correct syntax to run cron every 48 hours?
No, this will not work. Minutes may only be subdivisions of an hour and don't consider time frames longer then one hour.
In real cron syntax, this would work:
2 2 */2 * * do_something
## run ...
5
votes
How do I execute manage.py in Google App Engine?
Perhaps this is useful for someone else who encounters this. It is certainly advisable to use @George's answer for normal operation, but in a pinch you can shell into run a python command from App ...
5
votes
How do I implement SSL on a private IP?
Just use a self-signed certificate as you already do, and don't try any dirty hacks to bypass the error. Provide your customers an option to replace that certificate with their own. The replacement ...
5
votes
Too many sites on apache
1. You might have more files open then you think. A way to tell (approximately) is:
lsof -u www-data | wc -l
2. try to increase stack size. Look how much current with
ulimit -s
and set new value ...
5
votes
nginx can't find /etc/letsencrypt/options-ssl-ngin.conf file
It seems you are missing /etc/letsencrypt/options-ssl-nginx.conf this file is the default configuration for all sites using a certbot installer. So this file normally gets created during the ...
5
votes
Invalid HTTP_HOST header. The domain name provided is not valid according to RFC 1034/1035
I had a similar issue, however, I didn't have proxy_set_header in my Nginx config file and it was simply include proxy_params;.
What happens here is according to Django documentation when your site is ...
4
votes
Graphite SQLite3 DatabaseError: attempt to write a readonly database
The owner and group were checked of the parent, i.e. /var/lib/graphite. It turned out that both were _graphite instead of apache. Changing the owner and group to _graphite and restarting apache2:
...
4
votes
504 Gateway Time-out uwsgi + nginx django application
I know I'm late to the party but after trying many of these suggestions (and others) I eventually found the timeout for me was occurring from my DNS - if you're using Amazon load balancers they have ...
4
votes
AWS RDS Postgres performance issue
I was having the same issue. The postgresql is setup on AWS RDS and it was having 100% cpu utilisation even after increasing the instance. I debugged with the method shown here and one of the method ...
4
votes
Cloud SQL periodic issues connecting OperationalError: (2062, 'Cloud SQL socket open failed with error: Transport endpoint is not connected')
It turns out that the source of this was connection limits as originally suggested by the Google Groups chat linked in the question.
The bug appeared because the Pipelines API uses webapp while the ...
4
votes
How to configure Django application at http://SERVER-IP/ instead of http://SERVER-IP/Project using bitnami aws?
You can use the bnconfig tool to move the app to root.
/opt/bitnami/apps/django/bnconfig --appurl /
You can find more information about the bnconfig tool here:
https://docs.bitnami.com/aws/...
4
votes
Accepted
Installing Shapely on Alpine docker
I struggled with the same issue (not working with Django and PostGres database though).
Finally I managed to tackle this with the solution of Amir. I added the repositories from dl-cdn.alpinelinux....
4
votes
django_session table killing my MySQL server and django app
You have too many expired sessions for these 7 years. You may try
manage.py clearsessions
https://docs.djangoproject.com/en/2.2/topics/http/sessions/#clearing-the-session-store
Django does not ...
4
votes
Accepted
How to debug Django/WSGI/Apache errors
There is a debugging mode that you can use provided by mod_wsgi. You can find the documentation here:
https://modwsgi.readthedocs.io/en/develop/user-guides/debugging-techniques.html
However, we found ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
django × 1018nginx × 369
apache-2.2 × 250
python × 224
mod-wsgi × 163
gunicorn × 130
ubuntu × 100
uwsgi × 96
apache-2.4 × 54
amazon-ec2 × 52
wsgi × 48
linux × 45
amazon-web-services × 43
postgresql × 40
docker × 38
web-server × 32
mysql × 31
reverse-proxy × 24
deployment × 24
fastcgi × 24
supervisord × 24
centos × 22
apache2 × 20
php × 19
ssl × 18