I am trying to setup NGINX to run FASTAPI.
I am trying to run FastAPI using nginx on AWS EC2 instance. I first ran the following command to create a nginx proxy_server:
sudo nano /etc/nginx/sites-enabled/fastapi_nginx
After that I wrote the following code in the file:
server {
listen 80;
server_name 3.X.X.X(PublicIP);
location / {
proxy_pass http:/127.0.0.1:8000;
}
}
To check if everthing is working properly, I ran the following command: `
sudo service nginx restart
However, I recieved the following error:
systemd[1]: Starting A high performance web server and a reverse proxy server...
nginx[4846]: nginx: [emerg] invalid URL prefix in /etc/nginx/sites-enabled/fastapi_nginx:7 nginx[4846]: nginx: configuration file /etc/nginx/nginx.conf test failed
systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
systemd[1]: nginx.service: Failed with result 'exit-code'.
systemd[1]: Failed to start A high performance web server and a reverse proxy server.
`
Any help to resolve this issue would be greatly appreciated.