用daphne部署网站的问题
来源:12-13 Nginx Gunicorn Daphne部署Django Channels应用
慕设计7341579
2022-07-21
我现在有个问题,就是我只用了daphne,整个项目也就跑,但今天有个问题是,出现这个错误。网页的网址解析不对。
它解析成了这个网址:
我把这个http://lanvisocket 改成http://127.0.0.1:8888它上面就变成了http://127.0.0.1:8888/pro/saveproductsku/,还是一样的找到网页,
但是其它页都能正确解析成功。老师,这是会是哪里搞错了。
正常是解析成我的网址才对。
写回答
2回答
-
Jack
2022-07-26
你的这个地方是处理ws请求的吧,ws请求都是/ws/开头
location /ws/ { # /ws/用于区分http请求和websocket
00 -
Jack
2022-07-26
我的nginx.conf完整配置是这样,供参考
user nginxworker_processes autoerror_log /var/log/nginx/error.logpid /run/nginx.pidinclude /usr/share/nginx/modules/*.confevents { worker_connections 1024} http { log_format main access_log /var/log/nginx/access.log main sendfile on tcp_nopush on tcp_nodelay on keepalive_timeout 65 types_hash_max_size 2048 include /etc/nginx/mime.types default_type application/octet-stream include /etc/nginx/conf.d/*.conf upstream uwsgi_backend { server localhost:8888 } upstream channels-backend { server localhost:8000 } server { listen 80 default_server listen [::]:80 default_server server_name _ root /usr/share/nginx/html include /etc/nginx/default.d/*.conf location / { proxy_http_version 1.1 proxy_set_header Host $host proxy_set_header X-Real-IP $remote_addr proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for uwsgi_pass uwsgi_backend include uwsgi_params } location /static/ { root /home/zanhu/zanhu/zanhu } location /media/ { root /home/zanhu/zanhu/zanhu } location /ws/ { proxy_pass http://channels-backend proxy_http_version 1.1 proxy_set_header Upgrade $http_upgrade proxy_set_header Connection 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 proxy_set_header X-Forwarded-Host $server_name } error_page 404 /404.html= /40x.html { } error_page 500 502 503 504 /50x.html= /50x.html { } } }
00
相似问题