CakePHP3とNginxの設定で苦労したので、覚え書きです。
/etc/nginx/conf.d/virtual.conf
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com/webroot;
index index.php index.html;
location / {
try_files $uri $uri?$args $uri/ /index.php?$uri&$args /index.php?$args;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param CAKE_ENV "production";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}