I'm running nginx 1.13.6. The configuration has this directive to serve a virtual host service.company.com/
using service.company.com/svc/
:
if ($server_name = service.company.com) {
rewrite ^(.*)$ /svc/$1 last;
}
The server starts successfully, albeit with an entry in error.log
:
[emerg] 60841#0: invalid number of arguments in "rewrite" directive in …
Oddly, the line number in the error is the last line of the configuration file. The error is consistent with a missing semicolon. But, there's a semicolon there. And everything works fine except that the rewrite rule is ignored.
Does this seemingly trivial command have a syntax error?
Is there a better approach to the original problem?