1
솔루션 없이도이 문제를 3 일간 해결하려고했습니다. 자, 저는 제 일에 압박감을 느끼고 있습니다. 저는 정말로 당신의 도움이 필요합니다.nginx 및 uwsgi를 사용하여 django 응용 프로그램을 배포하면 클라이언트가 서버에 연결할 수 없습니다.
나는 nginx가 정확한 포트 '20154'를 사용하여 netstat을 사용하고 있고, nginx -t 명령과 ok 명령을 실행했다는 것을 알고 있습니다. 클라이언트가 서버에 연결할 수 없기 때문에 로그에 오류가 없습니다.
은 아마 문제는 내가 모르는 uwsgi.init으로, 그래서 여기 내 단점 파일을 넣어 uwsgi 초기화 나는 당신의 도움으로이 문제를 해결하고 더 많은 학습이 문제를 해결 할 수 있기를 바랍니다을 파일.
nginx.conf 파일 :
user user;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
nginx를 활성화 사이트
upstream django {
server unix:///home/ctag/env_Compass4D/Compass4D/Compass4D.sock; # for a file socket
}
server {
listen 20154;
location /assets/ {
root /home/ctag/env_Compass4D/Compass4D/;
}
location /doc/ {
alias /usr/share/doc/;
#alias /home/ctag/Compass4D/env_Compass4D/Compass4D
autoindex on;
#allow 127.0.0.1;
}
location/{
#uwsgi_pass unix:/home/ctag/env_Compass4D/Compass4D/Compass4D.sock;
proxy_pass http://unix:/home/ctag/env_Compass4D/Compass4D/Compass4D.sock;
#proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
uwsgi_pass django;
include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
}
location /Compass4D {
root /home/ctag/env_Compass4D/Compass4D/;
}
uwsgi.init
# Compass4D_uwsgi.ini file
[uwsgi]
# Configuraciones Django
# ruta al directorio del proyecto (ruta completa)
chdir = /home/ctag/env_Compass4D/Compass4D/
# Archivo wsgi de Django
module = Compass4D.wsgi
# master
master = true
# numero de procesos (trabajadores)
processes = 5
# Ruta al socket
socket = /home/ctag/env_Compass4D/Compass4D/Compass4D.sock
# Permisos del socket
chmod-socket = 666
# Loggeo para detectar fallo al startup
#logto = /tmp/errlog
# Al cerrar limpiar el ambiente
vacuum = true
왜 지구에 당신이하고 있습니다 nginx를 포트에서 수신 대기 20154? 80과 443에서 SSL을 청취해야합니다. – e4c5
Nginx는 공개 서버 ** 소프트웨어입니다. 서버 내부에서 실행중인 서비스에 액세스하려는 누군가가 Nginx를 통과하게됩니다. e4c5가 물었던 것처럼, 왜 Nginx가 내부 서비스 로컬 포트를 듣고 싶습니까? Nginx의 모든 목적을 저 버리는 것이지? – Rexford