Search code examples
nginxserverraspberry-pinginx-location

nginx: [emerg] unknown directive "location/"


Can someone help me solve this problem? Here is my code:

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

Here is the error i got:

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

I tried seeing if there changing the / to a \ or even remove it, but it didnt work, I also made sudo apt update to see if the problem was some kind of update and I also tried to rewrite the code again, but it didnt work.


Solution

  • Should be a space between location and / in etc/nginx/sites-enabled/flask_appt.