01-06-2019, 09:42 AM
Setting permission through chmod is often not enough when working with web servers. For things to work properly you have to change ownership of all the files in /var/www to the user and group that is used to run the web server services. Usually (this highly depends on the OS though) the user and group is www-data (99% of all Debian and Ubuntu based distros have this user for that purpose).
So long story short: adjust file ownership also instead of only using chmod. To do that you can use the chown (change owner) command. Syntax: chown -R user:group /path/to/filesorfolders. -R stands for recursive to apply it to all sub folders and files. An example: chown -R www-data:www-data /var/www
Once that is done there is even no need for the dangerous chmod 777.
So long story short: adjust file ownership also instead of only using chmod. To do that you can use the chown (change owner) command. Syntax: chown -R user:group /path/to/filesorfolders. -R stands for recursive to apply it to all sub folders and files. An example: chown -R www-data:www-data /var/www
Once that is done there is even no need for the dangerous chmod 777.