遭遇問題:directive “rewrite” is not terminated by “;”
用vi編輯器編輯完nginx.conf文件后生存,,在shell下執行呼吁/usr/local/web/nginx/sbin/nginx -t用以查抄nginx.conf設置文件是否正確(假設nginx被編譯到/usr/local/web/nginx/)正確的話:
[[email protected]]# /usr/local/web/nginx/sbin/nginx -tthe configuration file /usr/local/web/nginx/conf/nginx.conf syntax is okconfiguration file /usr/local/web/nginx/conf/nginx.conf test is successful
假如呈現如下問題:directive “rewrite” is not terminated by “;”
[[email protected]]# /usr/local/web/nginx/sbin/nginx -t[emerg]: directive “rewrite” is not terminated by “;” in /usr/local/web/nginx/conf/nginx.conf:160configuration file /usr/local/web/nginx/conf/nginx.conf test failed
處理懲罰要領:將從頭后的url用雙引號引起來!
墮落:rewrite ^/date/([0-9]{6})/?([0-9]+)?/?$ /index.php?action=article&setdate=$1&page=$2 last;正確:rewrite “^/date/([0-9]{6})/?([0-9]+)?/?$” /index.php?action=article&setdate=$1&page=$2 last;
看著那句directive “rewrite” is not terminated by “;”還覺得是沒;呢