If you want to install Cakephp 3 on your VPS running on Nginx Server you can follow these simple setup.
Setup CakePHP 3 on Nginx server
Step 1. To install Cakephp 3 first you need to install composer. You can download composer file from official website. After downloading composer.phar file you can move that file to run your composer globally
sudo mv composer.phar /usr/local/bin/composer
Step 2. Once you successfully install composer you run below command to setup CakePHP 3 on your server.
composer self-update && composer create-project --prefer-dist cakephp/app app_name
After running this command if you find and error or killed exception you can clear composer cache using below command
sudo rm -R ~/.composer
Step 3. If Cake is installed successfully you can open browser and type your URL and check. Now we need to set Rewrite Rules for CakePHP 3 to make it work properly. To do this you need to open your site configuration setting using below command.
sudo nano /etc/nginx/sites-available/default
After enter this command hit entre a config file is open in terminal you need to add location if you are installing Cake in sub directory or not then you need to enter below expression in main location / line
location /test { // If not in sub directory then paste bellow line in main location /{} rewrite ^/test(.+)$ /test/webroot$1 break; try_files $uri $uri/ /test/index.php$is_args$args; }
I am installing my application in sub directory so i define test in expression you can replace test with name you give to your project.
Step 4. If everything okay you can restart your server
sudo service nginx reload
And after this refresh your page if configuration file setting is okay your css and webroot folder is accessible That’s it 🙂 .
If you are looking for affordable VPS with good technical support you can use Digital Ocean and with this link you can use services free for two month.