Deploying via NearlyFreeSpeech?

Hello, first time Kirby user here.

I recently made a site with Kirby and I’ve been trying to deploy it on NearlyFreeSpeech with Cyberduck, but I’m not actually sure how?

I’ve already uploaded all the files through SFTP, and the index page works fine BUT when I try to click a link from the index to another page, there’s a 404 error. From what I can tell, this is because of how content pages are kept in their own Content folder in Kirby, so I’m not sure what I’m supposed to do now.

If anyone else have experience using nearlyfreespeech, how did you do it? This is the first time I’ve tried to deploy anything, let alone a CMS, so this is all new to me

Have you made sure to upload the .htaccess file as well? If it is there, try to uncomment the line

# RewriteBase /

so that is reads:

RewriteBase /

If that doesn’t help either, check if rewriting is enabled on the server.

That did the trick! Thanks!

On second thought, can you also go over how to enable rewriting for the panel for the panel installation? Specifically

  • /site/accounts,
  • thumbs folder
  • content folder and all contained files and folders
  • /assets/avatars.

In the NFS FAQ, it says:

In order for a PHP or CGI script, or a daemon processes run as the “web” user, to write to a file, the “web” user must have write access to that file. There are two ways to accomplish this.

Set the file to be owned by the web group and set the permissions to allow group-writes. (E.g. chgrp web example.file and either chmod g+w example.file or chmod 664 example.file from the command line.)
Set the file to allow any writes. (E.g. either chmod a+w example.file or chmod 666 example.file from the command line.)
In order for a script or web process to create a file, it’s the permissions of the directory in which the file is to be created that matter. To allow this, do either of the following:

Set the parent directory to be owned by the web group and allow group writes. (E.g. to create /parent/dir/example.file, first chgrp web /parent/dir and then either chmod g+w /parent/dir or chmod 775 /parent/dir from the command line.)
Set the parent directory to allow any writes. (E.g. to create /parent/dir/example.file, do either chmod a+w /parent/dir or chmod 777 /parent/dir from the command line.)

I’ve installed Cyberduck’s command line interface, but am at a loss as to how to connect it and actually use it.

There are two things here:

  • one is file permissions that are set via chmod: permissions should be set the 644 for files/755 for folders
  • one is file ownership which is set via chown, the files should be owned by the apache web server user, usually www-data

I’m having trouble connecting via SSH. I get a “Permission denied, please try again.” error no matter how many times I input my password.

I’ve tried with both “ssh root@[hostname]”, as well as
"ssh [username]@[host ip]

Am I missing something here?

Have you read their documentation, e.g. https://faq.nearlyfreespeech.net/full/ssh#ssh

If you still can’t access your server via SSH, I suggest you contact their support.

So I was able to connect via SSH, but I don’t know how to change the file permissions with chmod/chown.

Here’s what I’ve tried thus far and what happens in return

chmod site/accounts
usage: chmod [-fhv] [-R [-H | -L | -P]] mode file ...

chmod 755 /site/accounts
chmod: /site/accounts: No such file or directory

chmod - rwx r-x r-x /site/accounts
chmod: rwx: No such file or directory
chmod: r-x: No such file or directory
chmod: r-x: No such file or directory
chmod: /site/accounts: No such file or directory 

chmod +755 site/accounts
chmod: invalid file mode: +755
[mimi-portfolio /home/public]$ chmod -755 site/accounts
chmod: illegal option -- 7
usage: chmod [-fhv] [-R [-H | -L | -P]] mode file ...

What exactly should I be entering?

Edit: Reloaded the panel page again and seeing this now?
scandir(/home/public/site/accounts): failed to open dir: Permission denied

the command for the thumbs folder would look like this (assuming, you are in your project’s root folder)

chmod -v 755 thumbs

without a slash before the folder name…

To change the rights for the content folder, you would have to use the -R flag.

Used these commands

$ chmod -v 755 site/accounts
$ chmod -v 755 thumbs
$ chmod -R 755 content
$ chmod -v 755 assets/avatars
chmod: assets/avatars: No such file or directory

But it doesn’t seem like anything happened. It’s back to the screen with the error message:

Also, what does the assets/avatars folder do exactly? I deleted it earlier on since I wasn’t using it and the index.html that was there in the default Kirby template was empty. Should I remake it?

The avatar folder must exist. As I said, apart from the permissions, the file ownership is important as well.

Recreated the avatar folder. Should the chown command be structured like the ones for chmod? If so, I keep getting
chown: filename: Operation not permitted errors

Google would have been your friend here, but the syntax is like this:

chown -cR www:data /content

You might have to use sudo to get root rights:

sudo chown -cR www:data /content

I can’t tell what you current owner is though, you can check that by typing

ls -la 

into your terminal.

Check the user:group of the public folder too, since this effects anything inside it. No amount of changing permissions and ownership of the contents of that folder will help because with Linux you need owner and rights to the full path.

The current owner of the public folder is
drwxr-xr-x 8 261686 261686 12 Mar 11 18:05 public

Ownership of the contents of the public folder is

 [/home/public]$ ls -la
total 40
drwxr-xr-x   8 261686  261686    12 Mar 11 18:05 .
drwxr-xr-x   8 root    261686     8 Feb 21 03:27 ..
-rwxr-xr-x   1 261686  261686  1433 Mar 11 18:05 .htaccess
drwxr-xr-x   7 261686  261686     8 Mar 14 20:59 assets
drwxr-xr-x   6 261686  261686     7 Mar  8 06:18 content
-rwxr-xr-x   1 261686  261686   292 Mar  8 06:18 index.php
drwxr-xr-x  10 261686  261686    22 Mar  8 06:18 kirby
-rwxr-xr-x   1 261686  261686  6261 Mar  8 06:18 license.md
drwxr-xr-x   4 261686  261686     8 Mar  8 06:18 panel
-rwxr-xr-x   1 261686  261686  2049 Mar  8 06:18 readme.md
drwxr-xr-x  13 261686  261686    13 Mar  8 06:18 site
drwxr-xr-x   4 261686  261686     5 Mar  8 06:18 thumbs

I’ve been trying chown -cR www:261686 public and the other folders as well, but it still gets Operation not permitted errors.
When I try to use the sudo command from either home or home/public,

 [/home/public]$ sudo chown -cR www:data /content
-bash: sudo: command not found

Ok, then you don’t have the rights to change this. What you could try to do is set permission to 777 instead of 755 for testing if it works then.

If it does, I suggest you contact your provider to find out if this is what they expect you to do or if there is anything else they suggest.

I was able to get it to work. Changing the group to chgrp web and then applying chmod 664 did the trick.

I also had to do that for site/accounts/.logins specifically, not just site/accounts.

Thanks for all the help!