First, configure PHP-FPM.

Then…

nano /etc/nginx/sites-available/your.site.com.conf
server {
 server_name your.site.com;
 listen 80;

index index.php index.html index.htm;
 root /var/www/vhosts/your.site.com/webroot;


 # CakePHP
 # main cakephp rewrite rule
 location / {
 try_files $uri $uri/ /index.php?$uri&$args;
 }

location ~ .php$ {
 root /var/www/vhosts/your.site.com/webroot;
 try_files $uri =404;
 fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 fastcgi_buffer_size 128k;
 fastcgi_buffers 256 4k;
 fastcgi_busy_buffers_size 256k;
 fastcgi_temp_file_write_size 256k;
 }


location ~ /\.ht {
 deny all;
 }

error_page 500 502 503 504 /50x.html;




 location = /50x.html {
 root /usr/share/nginx/html;
 }

error_log /var/log/nginx/your.site.com.error.log;
}


# After:
# chmod -R 777 /var/www/vhosts/your.site.com/logs
# chmod -R 777 /var/www/vhosts/your.site.com/tmp/cache
Advertisements