Answer the question
In order to leave comments, you need to log in
How to redirect to the desired route in nginx?
All the best!
Here is part of nginx config
server {
listen 443 ssl;
server_name nameone.com;
server_name nametwo.com;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:20m;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
if ($request_uri = "https://nameone.com"){
return 301 https://nameone.com/routea;
}
location /routea/ {
proxy_pass http://localhost:8087;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
}
}
Answer the question
In order to leave comments, you need to log in
Because there is no host in $request_uri.
That's right
location = / {
return 301 https://nameone.com/routea/;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question