弄好了,发现是 ip地址写错了一个数字而已,唉
<python manage.py runserver 项目可以正常启动>
nginx 监听两个端口 80和9000:
# nginx 监听80端口
server {
listen 80;
listen [::]:80;
server_name localhost;
charset utf-8;
location / {
root /home/index/general_office/dist;
index index.html index.htm;
autoindex_localtime on;
}
error_page 404 /40x.html;
location = /40x.html {
root /home/index/error_page/html;
}
}
浏览器测试: http://11.111.111.11/ 正常进入主页
# nginx 监听9000端口 (接收前端 axios请求的端口)
server {
listen 9000;
server_name 11.111.111.11;
charset utf-8;
client_max_body_size 5M;
location / {
uwsgi_pass 127.0.0.1:9001; # 转发给 uwsgi 和 django
include /etc/nginx/uwsgi_params;
}
}
浏览器测试: http://11.111.111.11:9000/ 正常进入 django 项目的主页,说明 nginx 对 9000端口转发 uwsgi 正常
# uwsgi 监听 127.0.0.1:9001 接收nigex的转发,并回转
[uwsgi]
socket=127.0.0.1:9001
chdir=/home/backend/general_server
wsgi-file=%(chdir)/general_server/wsgi.py
buffer-size=65535
process=6
threads=2
pidfile=uwsgi.pid
daemonize=uwsgi.log
mastar=True
问题描述:
这里我点主页登录, 怎么样都没用处,
nginx 中的 access.log 文件没有 post 日志
uwsgin.log里也没有日志
感觉post 不起作用,请教解决方法
#nginx 和 uwsgi 放在同一容器,生成代码如下
docker run -it --name django-nginx1.0 --hostname django-nginx1.0 --restart always --network host
-v /home/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
-v /home/static:/home/static
-v /home/code/index:/home/index
-v /home/code/backend:/home/backend
-v /home/nginx/conf.d:/etc/nginx/conf.d --privileged=true
django-nginx:1.0 /bin/bash # django-nginx:1.0 自制镜像名