server {
listen 80;
server_name xxx;
root /xxx/public;
index index.php index.html index.htm;
location / {
add_header Access-Control-Allow-Origin *;
try_files $uri $uri/ /index.php?$args;
}
location ~ .*\.(php|php5)?$ {
add_header Access-Control-Allow-Origin *;
#fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^.+\.(gif|jpg|jpeg|png|ico|swf|flv)$ {
expires 30d;
}
}
你把xxx换成你自己的路径和域名,试试看