Answer the question
In order to leave comments, you need to log in
Nginx proxy_pass returns 404, where is error in http.conf?
on localhost:3000 raised react
on localhost:5090 raised API
on GET requests answered
decided to try to make http proxying
made http.conf
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost_access.log main;
error_log /var/log/nginx/localhost_error.log warn;
location /nginx_status {
stub_status on;
allow 127.0.0.1;
deny all;
}
location /service {
proxy_pass http://service1:5090;
# Do not change this
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /react {
proxy_pass http://localhost:3000;
# Do not change this
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
FROM nginx:1.15.8
#change timezone on Moskow
ENV TZ=Europe/Moscow
RUN apt-get update && apt-get install -yy tzdata
RUN cp /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get install -yy telnet iputils-ping curl
COPY conf.d/* /etc/nginx/conf.d/http/
COPY nginx.conf /etc/nginx/nginx.conf
2022/02/08 21:25:59 [error] 7#7: *1 open() "/usr/share/nginx/html/react" failed (2: No such file or directory), client: 172.21.0.1, server: localhost, request: "GET /react HTTP/1.1", host: "localhost"
Answer the question
In order to leave comments, you need to log in
The problem here is
COPY conf.d/* /etc/nginx/conf.d/http/
COPY nginx.conf /etc/nginx/nginx.conf
the first command replaces the contents of the http folder and there lay everything copied from conf.d
the second command replaces everything in the nginx folder with nginx.conf. Those. the first command does nothing. Or rather, the second kills everything that the first does.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question