Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Using a chmod of 777 grants world read, write, and execute, so it’s not exactly secure and I would not recommend keeping those permissions.
With properly setup user and group permissions, you shouldn’t need such open access – generally all files are at least 644 and directories 755. Since you’re using Apache, the files and directories need to be owned by the user that Apache is running as.
In most cases, www-data is the user and group that Apache uses, unless you’ve configured it to use another user or the repository you’re using has done so.
So what you need to check is ownership. You can see what user and group owns a file or directory by using ls -al on a directory.
You’ll see something like:
drwx------ 5 root root 4096 Apr 19 21:20 .
drwxr-xr-x 23 root root 4096 Apr 19 02:05 ..
If you’re seeing root on the third and fourth column in the directory where your files are located, then that’s probably the issue.
You can change ownership permissions using chown which also supports recursion, like chmod.
For example, to change ownership of files in /var/www/html to www-data, we’d use:
chown -R www-data:www-data /var/www/html
SSH to the machine then cd to the directory and run the following.
sudo chmod -R 777 /path/to/dir