Home >Backend Development >PHP Tutorial >Nginx 502 error (django+nginx, not php-fmp)
This article mainly introduces the Nginx 502 error (django nginx, not php-fmp). Now I share it with you and give it a reference. Let’s take a look together
Many explanations for Nginx errors on the Internet are that the relevant modules are not running, so first use the ps command to check whether the module is turned on. For example, the most common use is php-fmp in php nginx. module, if it is closed, run the command:
service php-fpm restart && service nginx restart
But I am using django nginx, which has nothing to do with php, so I need to check the nginx error log.
The log location of nginx is in the nginx configuration file. The default configuration file location is: /etc/nginx/nginx.conf, so run:
vim /etc/nginx/nginx.conf
in the curly braces of http Found in:
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log ;
It indicates the log location of normal connection/var/log/nginx/access.log The log file location of abnormal connection /var/log/nginx/error.log
Locate the log file location of the abnormal connection, just:
vim /var/log/nginx/error.log
You can see:
2018/04/17 13:05:39 [error] 9680#9680: *1 connect() failed (111: Connection refused) while connecting to upstream, client: XXXX, server: XXXX, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host : "XXXX"
This is connected to uwsgi, so uwsgi needs to be turned on first, run:
##uwsgi -i uwsgi.ini &
The above is the detailed content of Nginx 502 error (django+nginx, not php-fmp). For more information, please follow other related articles on the PHP Chinese website!