So, I'm trying to do a very basic Nginx redirect from https://strnordicfin.eu/magnesium-fakta to https://strnordicse.eu/ntr/some/magnesium/ (just training domains, no worries).
My nginx-config looks like this,
worker_processes 1;
events { worker_connections 1024;
}
http {
server {
listen 80;
location https://strnordicfin.eu/magnesium-fakta {
rewrite https://strnordicfin.eu/magnesium-fakta https://strnordicse.eu/ntr/some/magnesium/$request_uri permanent;
}
}
}
- but all this achieves is an error to pod and nginx 404 page,
[error] 19#19: *1 open() "/etc/nginx/html/magnesium-fakta" failed (2: No such file or directory), client: 10.244.10.130, server: , request: "GET /magnesium-fakta HTTP/1.1", host: "strnordicfin.eu"
I see that nginx is trying to open from pods /etc/nginx/html/magnesium-fakta, that is an empty directory, it should be getting it's info from https://strnordicse.eu/ntr/some/magnesium/.
Searching from net gives a lot of answers, but in those the server is mainly onsite not in a pod.
Edit: made some adjustments, nginx-config is now -
http {
server {
listen 80;
root /;
location https://strnordicfin.eu/magnesium-fakta/ {
return 302 https://strnordicse.eu/ntr/some/magnesium/magnesium-fakta/$request_uri;
}
}
the error message changed to -
[error] 20#20: *2 "/magnesium-fakta/index.html" is not found (2: No such file or directory), client: 10.244.8.172, server:
but still no redirect.