I want to redirect the login page to login2 page. Here is my conf, but when accessing login, error “500 Internal Server Error”. How can i modify the conf. (vue’s routing is in history mode)
server {
listen 81;
server_name example.com;
location / {
if ($request_filename ~* ^.*?.(html|htm)$) {
add_header Cache-Control "no-cache, no-store";
}
root /tmp;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /login {
rewrite ^ /login2 last;
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://example.com/;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
proxy_read_timeout 3000;
proxy_buffering off;
proxy_redirect default;
add_header X-Debug-Http-Host $http_host;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
Can i use rewrite here, or is there any other good way?
New contributor
ruochen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.