Api在Django框架中,Web应用程序在角度上,两者都是不同的项目。Nginx和gunicorn运行良好,并将两个项目上传到相同的目录中,但当我访问域时,它显示了Django应用程序默认页面。我想显示我的静态html页面,而不是Django默认页面。
'server{
listen 443;
server_name class.domain.com;
root /var/www/html/;
index index.html;
location /static/ {
try_files $uri $uri/ /index.html;
}
location ~ ^/ {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}'发布于 2022-02-23 08:51:31
'server{
listen 443;
server_name class.domain.com;
root /var/www/html/;
index index.html;
location /static/ {
try_files $uri $uri/ /index.html;
}
location /api {
rewrite ^/api(.*) $1 break;
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}' https://stackoverflow.com/questions/71231674
复制相似问题