First, configure PHP-FPM.

Then…

nano /etc/nginx/sites-available/your.site.com.conf
server {
 server_name your.site.com;
listen 443 ssl;
  ssl on;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_certificate /etc/ssl/certs/2018/hosting_deec_uc_pt.crt;
 ssl_certificate_key /etc/ssl/certs/2018/hosting_deec_uc_pt.key;
 ssl_prefer_server_ciphers on;
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;


}
server {
 server_name your.site.com;
 listen 80;

rewrite ^ https://$server_name$request_uri? permanent;
}
# After:
# chmod -R 777 /var/www/vhosts/your.site.com/logs
# chmod -R 777 /var/www/vhosts/your.site.com/tmp/cache
Advertisements