server {css
listen PORT; #PORT爲監聽端口
server_name SERVER_NAME; #SERVER_NAME爲域名
charset utf-8;
autoindex off;html
location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|css|js|images|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ { #所能匹配到的靜態文件,本項目內鎖涉及到靜態文件類型都須要匹配到,不然程序會去nginx的文件裏去找須要的文件併產生errorr日誌(見文末圖片)
expires 30d; #客戶端瀏覽器緩存時長
root /home/wwwroot/shanglian; #項目目錄
}nginx
error_log /usr/local/nginx/logs/XXX_error.log error;
access_log /usr/local/nginx/logs/XXX_access.log;
}瀏覽器