The original post: /r/nginx by /u/Shougun1310 on 2024-06-27 10:46:41.
I'm just trying to test out NGINX, I'm using a simple index.html and a backed running on express and node.
My config -
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root C:/nginx-1.26.1/html;
index index.html index.htm;
}
location /api/ {
try_files $uri u/proxy;
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
No matter what I do it keeps giving me teh same error -
2024/06/27 15:46:14 [error] 27080#19876: *58 CreateFile() "C:\nginx-1.26.1/html/api/test" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: localhost, request: "GET /api/test HTTP/1.1", host: "localhost", referrer: "http://localhost/"
I'm out of my wits here with what to do.