今天配置Server_name時,希望禁用一些域名,應為這些域名我想讓通過另外一個Server配置
server_name "~^((\w*[^w]{1}\w*)|w{1,2})\.hello\.com$";
就是不允許www.hello.com訪問這個配置
但是一直提示Starting nginx: nginx: [emerg] directive "server_name" is not terminated by ";"
發現原來是{}引起的錯誤,只需要給正則添加一個雙引號就可以了。
另外,在centos數據備份時,寫了sh腳本,也一樣,如果沒有雙引號也會出現這個問題
tar zcvPf "/bak/boot.`date +%Y%m%d%H%M`.tar.gz" "/boot/";