我的 nginx 配置文件如下所示。
server {
listen 80;
server_name http://hg.rawdatatech.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static/ {
alias /home/home-garden/staticfiles/;
}
}
当我使用此配置运行我的 Django 应用程序时,我看到“可疑符号错误”和连接拒绝错误 nginx 错误日志。我的配置有什么错误吗?
答案1
http://
从server_name
配置中删除
新的配置将是这样的
server {
listen 80;
server_name hg.rawdatatech.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static/ {
alias /home/home-garden/staticfiles/;
}
}