Trouble using Kirby on DigitalOcean


#1

I’m trying to run a Kirby site off a Virtual Host using Digital Ocean. Whenever I go to the /panel it redirects to /panel/install.

With the following Error:

  1. You are only allowed to run the panel installer from the same computer that is the server or by setting the option panel.install to true in your /site/config/config.php
  2. /site/accounts is not writable
  3. The thumbs folder must be writable.
  4. The content folder and all contained files and folders must be writable.
  5. /assets/avatars is not writable

How can I go about assessing what the problem is and troubleshooting it?


#2

Have you already created an account and is the account file readable?


#3

Yes, I created the account locally where it works fine. The accounts folder and it’s content has permissions of 755


#4

And the rest of the folders in that error message?


#5

Please also check file/folder ownership


#6

Everything on the list is set to 755. How can I check ownership?


#7

if you do a ls -la in your Kirby folder, you’ll see the permissions and ownership.

You can change ownership with chown


#8

Give serverpilot.io a shot, I recommend using them with Digital Ocean to all my clients, the free plan is more then usable for most people.


#9

I executed ls -la command within my /var/www. The following appears:

Now I need to execute something like sudo chown -R $USER:$USER with the path to each of my websites? Is this correct?


#10

Thank you for the suggestion @RushmerIO. That is something I am considering, although, I feel managing it all through the terminal is a great way to learn.


#11

I just had a look at this on my server, and the owner of the directories and files is my user, the group is www-data however as I think php needs to be able to read using the www-data group.

So i think you would want to do sudo chown -R $USER:www-data and also you probably want to add your user to the www-data group, if I remember correctly sudo usermod -a -G groupName userName. Someone may be able to correct on this.


#12

Hello CallumND,

Try this in your terminal:

# go to your root web folder
cd /var/www

# change owner for all your Kirby files and folders:  root > www-data (I suppose www-data is your web user)
sudo chown -R www-data:www-data *

# change right on all your Kirby files and folders
sudo find /var/www/ -type d -exec chmod 755 {} +
sudo find /var/www/ -type f -exec chmod 644 {} +

# check the result
ls -la

# you should see something like that
drwxr-xr-x ...  www-data www-data ... -> folder
-rw-r--r--  ...   www-data www-data ... -> file


Files not writable on server
#13

Thank you @gillesvauvarin for the taking the time to respond with detailed explanation of steps. This has indeed solved my problem, I am now able to access the panel with no problems.


#14

Just out of interest, do you not get problems with this if you need to update files through ftp as your user and group owners are both www-data? Or do you always use the command line to add files?


#15

In my case, my server (so www-data user) watch a remote Git repository and if it detect a change, it pulls the corresponding files. To deploy my code, I just have to push my committed files to my remote repository and my server will detect this change and will pull the files.

If I would directly upload my files from my local environment to my remote server via SFTP, yes I would have some permissions problem because the owner will be different.

If you want to use SFTP from your local environment to your server, you will have to change the user and permissions.


#16

Cool setup there.

Yeah, that’s been my experience regarding permissions and SFTP, so I was just double checking there wasn’t something else going on there :slight_smile: .


#17

When pulling from a repo to my remote server, I use git hooks to change ownership and permissions. I don’t think this can be automated when using (S)FTP.


#18

Hi @ElliotSmith91,

Maybe you could be interested by this post: http://blog.netgusto.com/solving-web-file-permissions-problem-once-and-for-all/


#19

Hi @gillesvauvarin,

Funny you mention that post as I used it in a reply to someone’s question on here earlier! Definitely a good work around for problems like these :D.

Cheers!


#20

Thanks for the great resource @gillesvauvarin. Sorry if this seems like a silly questions but how do I find out what my developer user is called? In that example it’s dev1. I have been using a non-root user account with sudo privileges through SSH to copy some but sometimes a GUI like Cyberduck is useful. I’d like to find a solution where I can use both options and in future set up automatic deployment through Git, outlined here.