nginx的rewrite注意事项

如果rewrite中包含{}号,则该规则要加双引号

下面这种是错误的,

rewrite ^(.*)/archives/([\d]{1,5}).html$ ^(.*)/?p=$2 last; 

输入以下指令来检查配置的正确性:

/usr/local/nginx/sbin/nginx -t

 nginx会提示你:

2010/10/11 11:28:22 [emerg] 28797#0: directive "rewrite" is not terminated by ";" in /usr/local/nginx/conf/nginx.conf:435
2010/10/11 11:28:22 [emerg] 28797#0: the configuration file /usr/local/nginx/conf/nginx.conf test failed
 

 

rewrite "^(.*)/archives/([\d]{1,5}).html$"  ^(.*)/?p=$2 last;

 

你可能感兴趣的:(html,nginx)