I am trying to setup a proxy with docker-compose, which works just fine.
However.
I am hosting the proxy a "/" endpoint, which seems to override my default html files from the nginx root folder. The proxy server only have one endpoint with the url "/login"
How can I see my index.html? Can I override the proxy, that if some file exists, then show that file instead?
Hope you understand
Nginx conf file:
server {
listen 80;
server_name localhost;
index index.html;
root /var/www/;
location / {
proxy_pass http://flask-app:5000/;
proxy_set_header Host "localhost";
}
}
PS: If I remove the proxy I can see HTML files just fine.
EDIT
I tried this:
server {
listen 80;
server_name localhost;
index index.html;
root /var/www/;
location / {
try_files $uri $uri/ @proxy;
}
location @proxy {
proxy_pass http://flask-app:5000/;
}
}
Is this how I was suppose to implement it?
I get this error when I startup:
"proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/conf.d/default.conf:12
nginx | nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/conf.d/default.conf:12
/from theproxy_passstatement. - Richard Smith