## Laravel项目的nginx虚拟机配置文件
~~~
server {
listen *:80;
client_max_body_size 100M;
server_name rester.app; #你的域名
charset utf-8;
set $root /Users/Carlos/www/rester/public; # public目录
index index.php;
root $root;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
}
# 以下配置可以忽略
# 网站的图片较多,更改较少,将它们在浏览器本地缓存15天
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 15d;
}
#网站会加载很多JS、CSS,将它们在浏览器本地缓存1天
location ~ .*\.(js|css)?$
{
expires 1d;
}
# 访问日志
access_log /var/log/nginx/rester.app.access.log;
# 错误日志
error_log /var/log/nginx/rester.app.error.log;
}
~~~