If you’re currently running the LAMP/LEMP stack without a control panel on cloud server, you must specify the correct CHMOD for both directories/folders and files. This can be done via command line interface (CLI).
The standard CHMOD is usually 0755 for folder/directory permissions and 0644 for file permissions. For example, in this guide we will set folder pemission to 0755 (-rwxr-xr-x) on directory /home/knot35.com/public/.
Simply run the following command:
$ find /home/knot35.com/public/ -type d -exec chmod 755 {} \;
With the above command it will also set recursion permissions for all folders inside the /public/ directory. On the same screen, we also need to set recursion file permissions to 0644 (-rw-r–r–) for all files inside the public directory.
$ find /home/knot35.com/public/ -type f -exec chmod 644 {} \;
Make sure to replace /home/knot35.com/public/ with your actual directory or document root on your virtual machine. Don’t forget to also set correct ownerships for all file/folders inside your document root (path to your public directory).
For example, we need to change user and group ownerships to knot35. So, simply run the following command. It will set user and group ownerships to knot35 on all file and folders inside /home/knot35.com/public/ directory.
$ chown -R knot35:knot35 /home/knot35.com/public/