I keep getting errors from joomla saying it can't write to.
configuration.php
An error has occurred.
0 Could not write to the configuration file
I added recommended permissions to folders 755 and files 644 with no luck.
I am using root to log into so not sure what login Joomla is using to write to a file
/var/www/websitecom.com/html
line on var/www/mywebsite.com/html folder
drwxr-xr-x 18 root root 4096 Oct 11 21:47 .
drwxr-xr-x 3 root root 4096 Oct 11 17:48 ..
-rw-r--r-- 1 root root 3005 Aug 26 07:59 .htaccess
-rw-r--r-- 1 root root 18092 Aug 26 07:59 LICENSE.txt
-rw-r--r-- 1 root root 4883 Aug 26 07:59 README.txt
drwxr-xr-x 11 root root 4096 Sep 10 18:23 administrator
drwxr-xr-x 2 root root 4096 Sep 10 18:23 bin
drwxr-xr-x 6 root root 4096 Oct 8 17:43 cache
drwxr-xr-x 2 root root 4096 Sep 10 18:39 cli
drwxr-xr-x 23 root root 4096 Oct 5 18:57 components
-rw-r--r-- 1 root root 3342 Oct 12 12:13 configuration.php
-rw-r--r-- 1 root root 974 Oct 8 17:50 favicon-16x16.png
-rw-r--r-- 1 root root 1810 Oct 8 17:50 favicon-32x32.png
-rw-r--r-- 1 root root 15086 Oct 8 17:50 favicon.ico
-rw-r--r-- 1 root root 79731414 Oct 11 18:10 food.zip
drwxr-xr-x 10 root root 4096 Oct 5 17:45 images
-rw-r--r-- 1 root root 39626638 Oct 8 18:12 images.zip
drwxr-xr-x 2 root root 4096 Sep 10 18:23 includes
-rw-r--r-- 1 root root 182 Oct 11 21:47 index.html
-rw-r--r-- 1 root root 1420 Aug 26 07:59 index.php
drwxr-xr-x 4 root root 4096 Sep 10 18:23 language
drwxr-xr-x 5 root root 4096 Sep 10 18:23 layouts
drwxr-xr-x 13 root root 4096 Oct 5 11:31 libraries
drwxr-xr-x 2 root root 4096 Oct 12 13:12 logs
drwxr-xr-x 38 root root 4096 Oct 5 18:59 media
drwxr-xr-x 33 root root 4096 Oct 5 18:58 modules
drwxr-xr-x 21 root root 4096 Oct 5 18:59 plugins
-rw-r--r-- 1 root root 842 Oct 1 2014 robots.txt
-rw-r--r-- 1 root root 836 Aug 26 07:59 robots.txt.dist
drwxr-xr-x 6 root root 4096 Sep 10 18:23 templates
drwxr-xr-x 2 root root 4096 Oct 12 13:12 tmp
-rw-r--r-- 1 root root 1690 Aug 26 07:59 web.config.txt
Premissions for the html folder
drwxr-xr-x 3 root root 4096 Oct 11 17:48 .
drwxr-xr-x: command not found
root@pitamyshawarma:~# drwxr-xr-x 4 root root 4096 Oct 11 17:32 ..
drwxr-xr-x: command not found
root@pitamyshawarma:~# drwxr-xr-x 18 root root 4096 Oct 11 21:47 html
drwxr-xr-x: command not found
The NGINX web server runs as the user
www-data
and the groupwww-data
by default on Ubuntu systems. (So does Apache2 but that's not necessarily relevant to this question) And the default configuration of PHP also has such setup to use thewww-data
user/group as well.The typical way to set up your website 'directory' and files is to set the user ownership to
root
(or your own user), and the group ownership towww-data
and provide thewww-data
group with read/write.We can do this with only a few commands:
Change user/group ownership for all files and folders to
root:www-data
.Set proper permissions for directories and folders.
Folders: 775 (
rwxrwxr-x
) - allow owner access and group members read/write access to folders, and allow 'other users' to traverse the directory treeFiles: 660 (
rw-rw----
) - allow owner access and group members read/write access to files, disallow all other users access to the files themselves.Set the
setgid
bit on the directories. This way, when files are created by eitherroot
or the web server, the 'group' ownership of new files will remainwww-data
.Make sure the docroot actually has the proper permissions.
Now, your webserver should be able to write to the new configuration file.