nginx configured as loadbalancer returning 404 not found
Kaushal Shriyan
kaushalshriyan at gmail.com
Fri May 17 11:19:59 UTC 2024
Hi,
I am running nginx version 1.26 on "Ubuntu 22.04.4 LTS" I have configured
the nginx as load balancer and the configuration details are as follows
# nginx -v
nginx version: nginx/1.26.0
#
server {
listen 8085;
#server_name 172.30.2.11;
server name 210.11.1.110;
location / {
# Define the upstream servers for load balancing
proxy_pass http://backend/;
# Set HTTP headers
proxy_set_header Host $host;
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;
}
location /api/docs/ {
proxy_pass http://backend/api/docs/;
proxy_set_header Host $host;
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;
}
}
upstream backend {
server tead-local.com:80;
}
When i hit http://tead-local.com:80/api/docs/ I get http 200 response from
the backend server whereas when I try to hit using public IP :-
http://210.11.1.110:8085/api/docs/ I encounter http 404 not found.
101.0.62.200 - - [17/May/2024:16:38:24 +0530] "GET /api/docs/ HTTP/1.1" 404
153 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Ddg/17.5" "-"
[image: image.png]
Please guide me. Thanks in advance.
Best Regards,
Kaushal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20240517/052ce23c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 18298 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20240517/052ce23c/attachment-0001.png>
More information about the nginx
mailing list