typemill / typemill

Typemill is a lightweight, flat-file CMS designed for simple, fast, and flexible website and eBook creation using Markdown.
https://typemill.net
MIT License
427 stars 60 forks source link

can't complete the setup on a subdomain webspace #274

Closed MysterieDev closed 2 years ago

MysterieDev commented 2 years ago

Hello, i really like Typemill, the features and the plugins it has to offer. However upon installation of the unzipped folder,

i am able to get to the point where i get the register screen (initial user) but not past that. It always gives me the error "please check your input" - if i switch errorlog on in the yaml, no further explanation rises up.

i dont know why it hangs up in the setup controller, i did not dig deep enough into the application for that, however, i am certain that my input is well formed as it also works fine in xampp!

I assume it has something to do with the webspace configuration, because it doesn't seem to write any files, nor can it supossedly read them I get the error > content folder is empty < on the homepage even though the sample site should be shown when i visit the homepage after statically inserting a user via YAML

The rights for the folders and so on are configured rightly and my VHOST of my subdomain also points to the right folder. Maybe im not seeing somehting in the htaccess (mod rewrite also on).

In comparison - if i install a wordpress-distribution everything works as it should, so there has to be a cue as to why this does not work

trendschau commented 2 years ago

Hm, hard to say from the distance and I am AFAIK for some days. The empty folder message sounds like the read and write permissions for apache user is missing, which should be www-data. The check input message at the beginning might also result from a failing csfr-check, so you could double check if cookies in your browser are enabled. Iif it works with xampp, do you have the chance to ask your hoster to help with configurations? I run several instances with subfolders without any problems, so it should work.

MysterieDev commented 2 years ago

@trendschau i certainly know that this is really hard to judge from the distance without having access to the full context, which i can give if you if you are interested!

i don't have a root server, only the webspace, so i do not have access to the full configuration of the server. I guess it could also be rooted in the rights the server gives e.g. not having set AllowOverride All or something of this category. But this kind of contradicts the fact that wordpress (which i also run on subdomains) as counterexample happily moves creates, and deletes files without any kind of fails or missing rights to do so. I also wonder, because the .htaccess file of wordpress is even smaller than the one provided in typemill. Maybe it is hidden somehwere in a .php file.

I dont think it is rooted in CSRF problems as i tried this on multiple devices, multiple browsers and having set off all plugins etc.

MysterieDev commented 2 years ago

OK, so I made sure that my provider definitely switched on the module for the rewrite engine. I also used Filezilla to look into the files and folders to make sure the same rights that typemills tutorial video shows in ftp are given.

I'd really like to resolve this so my next guess would be locating the code that writes the files onto the system. Could it be that it has problems with the webspspace setup, that means unable to create the file therefore the input validation fails? Again, though it shouldn't matter in theory, I don't own a root server and I don't know the exact config of the vhost, except where it points to.

All in all, php should be qualified to write files. Reading the document works aswell. I'll write a php snippet placing some files in my vhost to see if php is the root of the problem, which I don't think as of now

MysterieDev commented 2 years ago

https://learn.getgrav.org/17/troubleshooting/page-not-found i'll jump through this guide and give feedback asap. Grav theoretically works following the same principle

trendschau commented 2 years ago

Hi Josef, yes, that is a good method, and sorry that I can't help with that right now. Your updates are very welcome. If I find some time, I will start a troubleshooting page in the typemill-documentation, too.

MysterieDev commented 2 years ago

little update

I made sure the htaccess works by testing it using this help-page

https://learn.getgrav.org/17/troubleshooting/htaccess

i also wrote a file with the rights 644 with following code.

<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
?>

It produces the desired output aswell.

this is the folder it should write the user to and it has the granted rights: image

That leaves me with a bit of a baffled mind. I also pulled your Code into a code-Editor and see that typemill supposedly is using these commands. That leaves the question whats going on in my case. My guess is that the server configuration with Subdomain and VHost is doing me wrong.. maybe i will upgrade my hosting contract and see if i get more options to look into this phenomenon.

As of now im kinda standing here without a definite point for lookups

MysterieDev commented 2 years ago

We'll i finally got it to work theoretically!

i could track down the problem to permissions somewhere in the process.

If i recursively chang the permissions given in the ftp to 777 (which for everyone reading this - THIS IS DEFINITELY NOT AN APPROPRIATE SOLUTION FOR PROD), everything works fine.

Now, as somebody not addicted to server configuration, what do i have to change, and which folders are to be given more rights, the ones mentioned in the documentation https://typemill.net/getting-started/installation ?

giving the right for the group ? 775 folder 664 file?

EDIT: I tried recursively changing to 775 and 664, and in my case, that seems to be working for my system.

I think the reason for that is in certain Webproviders, they give out different users that belong to the same group, but that does not mean, that these users are the owners. so in certain setups that seems to be the solution.

What do you think @trendschau . Does this impose a security issue within the application?

trendschau commented 2 years ago

I am glad that you found a solution and that you shared it here, thank you!

In all setups that I did so far the rights 755 for folders and 644 for files worked fine and that is generally the recommended setup. But I work with simple webspaces where I do not have any influence on the organisation of users and groups so I am not an expert here. If you have the chance, then it makes sense (imho) to ask your hoster why the 755/644 combination does not work in your case and if they see any problems with a 775/664 setup (probably depends on who is in that group and if there is any chance that other persons get write access to your files in a shared hosting space, but again, I am not an expert here).

MysterieDev commented 2 years ago

I actually found an article regarding that on my provider

https://www.manitu.de/service/faq/entry/1303/Wie-lauten-die-optimalen-Rechte-fuer-Dateien-und-Verzeichnisse-auf-dem-Webspace/

https://www.manitu.de/service/faq/entry/1087/Welche-Rechte-muessen-Dateien-mindestens-haben-damit-Sie-ueber-den-Webserver-abrufbar-sind/

It's german, but it explains my phenomenon. I can almost guarantee, that this is not isolated to my service provider. Maybe it deserves a mention in the documentation.

I now got the site working like a charm with plug-ins and themes. I'll see if I can dig my nails into the source code, then I'll maybe pump out a plugin or two. Didn't work with php for a while but easy to get back into it!

trendschau commented 2 years ago

Great that it works now and thank you for sharing, I will check that and update the documentation. Plugins and themes would be great, I don't have the capacity to write and update much more of them, maintaining the core code is already quite time consuming :D

felix2018 commented 1 year ago

@MysterieDev I had the same problem with installing on "manitu" shared hosting. The easiest way to fix the problem is to use the menu point "Berechtigungen" in the webhosting admin area for your domain. See the manitu wiki article for details:

https://wiki.manitu.de/index.php/Webhosting:Dateiberechtigungen_f%C3%BCr_das_Webhosting-Paket

This will set files (660) and folders (770). I think this settings are more secure on manitu.

@trendschau But now I wonder if Typemill also sets the correct permissions in live operation, or if I always have to correct the permissions in the admin menu accordingly. That would be a reason to use another CMS, even if I have already "fallen in love" with Typemill on a localhost test installation, after I wanted to get away from the complexity of a WP website.

trendschau commented 1 year ago

@felix2018 nice to hear, thank you for the feedback! Typemill does not set permissions actively, it is done by the server, so I suppose the standard-permissions you mentioned are set on write operations. It should be easy to check if you create a page or folder with typemill

felix2018 commented 1 year ago

@trendschau Thank you for your answer. I tested it on manitu and it works, the standard-permissions are set correctly for new files and folders.