Route Multiple APIs with same Domain Name Nginx 404
By Andrew Adams •
I've got a requirement to a setup SSL on port 8080 with allowing user to acces multiple APIs developed and deployed on same server via https,
So I'm using NGINX to develop this SSL + Routing configuration.
This is the nginx/default.conf
server {
listen 8080 ssl;
server_name api.example.com;
ssl_certificate /etc/nginx/certs/api_example_com.pem;
ssl_certificate_key /etc/nginx/certs/api_example_com.key;
location / { proxy_pass
}
location /web/ { proxy_pass
}
location /admin/ { proxy_pass
}}
Currently, api.example.com is working correctly and I could access the API which runs on 4000 port via api.example.com.
But and giving 404 with following error on console,
22/Dec/2020:19:20:07 +0000] "GET /admin/ HTTP/1.1" 404 0 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"
1 Answer
Solved the issue with adding / end of proxy_pass URL
proxy_pass 1