nginx:[emerg] 未知指令“位置/”

问题描述 投票:0回答:1

有人可以帮我解决这个问题吗? 这是我的代码:

server {
   listen 80;

   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;
   }
}

这是我得到的错误:

nginx: [emerg] unknown directive "location/" in etc/nginx/sites-enabled/flask_appt:5
nginx: configuration file /etc/nginx/nginx.conf test failed

我尝试查看是否将 / 更改为 \ 甚至删除它,但它没有用,我还进行了 sudo apt update 以查看问题是否是某种更新,我还尝试再次重写代码,但它没用。

nginx server raspberry-pi nginx-location
1个回答
0
投票

应该是

location
/
之间的空格
etc/nginx/sites-enabled/flask_appt
.

© www.soinside.com 2019 - 2024. All rights reserved.