我一直在尝试使用Gunicorn作为我的应用程序服务器和Nginx作为反向代理来运行我的django生产服务器.
server {
listen 80;
server_name myproject.com;
location /static/ {
alias /var/www/myproject/static/;
}
location /media/ {
alias /var/www/myproject/media/;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/user/myproject/myproject.sock;
}
}
下面是我的gunicorn.conf文件:
description "Gunicorn application server handling my project file"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid user
setgid www-data
chdir /home/user/myproject/
exec gunicorn --workers 3 --bind unix:/home/user/myproject/myproject.sock myproject.wsgi:application
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn/socket
ListenStream=0.0.0.0:9000
ListenStream=[::]:8000
[Install]
WantedBy=sockets.target
当我尝试使用这些设置运行时.我收到以下错误:
connect() to unix:/home/user/myproject/myproject.sock Failed (111: Connection refused) while connecting to upstream
如果有人能帮助我理解我做错了什么就会很棒.谢谢
最佳答案
原文链接:https://www.f2er.com/nginx/434413.html