如何用Nginx提供版本号的静态文件?

我刚刚为wordpress完成了Nginx的安装,但所有带有?ver = x的静态文件都被redirect到了nginx的默认页面。

加工

/jquery-ui-1.8.6.custom.min.js

redirect到默认的Nginx页面

/jquery-ui-1.8.6.custom.min.js?ver=1

这是我的configuration。 我在这里错过了什么?

server { listen 80; root /var/www/domain.com; index index.php index.html index.htm; server_name domain.com; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { try_files $uri =404; #fastcgi_pass 127.0.0.1:9000; # With php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } 

谢谢大家提前。

将下面的内容添加到nginx中,只需要input文件名并忽略版本信息即可提供文件。

 location ~ ^/(assets/js|assets/css) { root path/to/the/static/files; access_log off; expires max; try_files $uri $1; }