我在部署带有uwsgi和nginx的django服务器时遇到问题
命令dev_ralph runserver 0.0.0.0:8000
启动开发服务器并正常工作。
但我现在的目标是部署一个生产django服务器,正如我所说的,我在这方面有一些问题
我的项目根目录是:/home/ralphadmin/uwsgi/capentory-ralph/ralph
以下是nginx virtualhost配置:
/etc/nginx/sites-available/ralph.conf
和/etc/nginx/sites-enabled/ralph.conf
:
# mysite_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
# server unix:///home/ralphadmin/uwgsi/capentory-ralph/ralph/mysite.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name 10.70.7.1; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /var/media; # your Django project's media files - amend as required
}
location /static {
root /home/ralphadmin/uwsgi/capentory-ralph/ralph/src/ralph/static/; # your Django project's static files
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/ralphadmin/uwsgi/capentory-ralph/ralph/uwsgi_params; # the uwsgi_params file you ins$
}
}
如您所见,我的静态文件位于/home/ralphadmin/uwsgi/capentory-ralph/ralph/src/ralph/static/
如果我尝试连接服务器,则默认的nginx页面位于我的浏览器中: nginx
我真的很感激一些有用的评论
------更新1
我调查了我的nginx日志,发现:
2020/02/11 15:18:44 [error] 19097#19097: *1 connect() failed (111: Connection refused)
while connecting to upstream, client: 10.70.7.254, server: 10.70.7.1, request: "GET /
HTTP/1.1", upstream: "uwsgi://10.70.7.1:8630", host: "10.70.7.1"
2020/02/11 15:31:55 [error] 19492#19492: *1 connect() failed (111: Connection refused)
while connecting to upstream, client: 10.70.7.254, server: 10.70.7.1, request: "GET
/favicon.ico HTTP/1.1", upstream: "uwsgi://10.70.7.1:8630", host: "10.70.7.1",
referrer: "http://10.70.7.1/"
。。。uwsgi正在运行,但仍然无法正常工作:(
目前没有回答
相关问题 更多 >
编程相关推荐