Reputation: 17
Why does not the nginx rewrite? "[FAIL] Reloading nginx configuration: nginx failed!"
rewrite ^/([0-9]+)/test.php http://domain.com:$1/;test.php last;
Destination address:
http://domain.com:1234/;test.php
Upvotes: 0
Views: 1947
Reputation: 79
When you use this syntax you will always have error nginx: [emerg] unknown directive "test.php" nginx: configuration file /etc/nginx/nginx.conf test failed
all text after
http://domain.com:$1/;
this is new directive. In your example test.php == directive, the same as server_tokens or keepalive_timeout.
So, if you want that your rewrite will be correct use this syntax
rewrite '^/([0-9]+)/test.php' 'http://domain.com:$1/;test.php' last;
Upvotes: 2