这是我的项目的Nginx conf 请告诉我为什么它不起作用
upstream django {
server 127.0.0.1:8037;
}
server {
server_name ;
listen :80;
return 301 https://www. $request_uri;
}
server {
listen 443 ssl;
ssl_certificate /etc/nginx/ssl.crt/server.crt;
ssl_certificate_key /etc/nginx/ssl.key/server.key;
server_name ;
charset utf-8;
server_tokens off;
access_log /etc/nginx/log/access.log;
error_log /etc/nginx/log/error.log;
location /static/ {
alias /home/app/public_html/Vishka/env/repo/project/Vishka/static/;
}
location / {
include uwsgi_params;
uwsgi_pass django;
}
}
在uwsgi日志中没有请求 我所有的请求都会丢失 enter image description here
答案 0 :(得分:0)
在使用该方案的端口80的服务器上检查
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
还要确保配置具有有效的语法
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
答案 1 :(得分:0)
这是因为已将子域设置为我的服务器,并且我在ssl设置中引用了主域