moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Garth Brady -
Number of replies: 8
Picture of Particularly helpful Moodlers

I have successfully upgraded from 5.0.x to 5.1.1+.  Here's my question:

I'm on a shared host where /username/public_html/subdir is where I've hosted moodle for many years.  To deal with the new /public pathing issue, I renamed subdir to old_subdir and created a symlink called subdir and pointed it to old_subdir.  This causes moodle 5.1 to load at subdir.mydomain.com.  Does this sound like the right approach?

Average of ratings: -
In reply to Garth Brady

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I am a little confused.  Why wouldn't you just keep moodle in the original subdir and then your symlink should just go to subdir/public?  

In reply to Emma Richardson

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
I agree, Emma, that Garth probably may not need to rename his moodle folder, but I can't quite tell by what has been provided.

I am going to assume that his "subdir" is the moodle code, as in /username/public_html/moodle. However, since "subdir" is used, it might be that "subdir" is any type of name. For example, I used to keep my moodles in folders named moodle3, moodle4, moodle5, so in my case, "subdir" is "moodle5."

If I kept my moodle inside public_html, I would have to create a symlink whose name cannot match a folder's name. I cannot have a symlink named moodle and a folder named moodle in public_html. So maybe this is what Garth has done. But I am not sure, Garth, because you then use a subdomain. So, Emma, I would say you are on target, but it depends on what Garth has done.

Garth, I can't say if your approach is "right," all I can say is that it seems to work as an approach. The key is that that the moodle/public folder should not be inside public_html.

I posted a video within this discussion:  I kind of do what you somewhat do, and I show how to comply with Moodle's security intent. But I don't use a subdomain. Also, I wouldn't claim that my method is the "right" method; it is one among other methods.

(I see a few more posts while I have been creating this one.)
In reply to Rick Jerz

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Garth Brady -
Picture of Particularly helpful Moodlers
"I am going to assume that his "subdir" is the moodle code, as in /username/public_html/moodle." - Correct

"because you then use "subdir" like a subdomain" - Yes, this is how my host sets up subdomains (each one in public_html/subdomain)

"The key is that that the moodle/public folder should not be inside public_html" - This I don't quite understand. I guess I misunderstood, but I thought this was the whole point with 5.1... that /public is the new 'webroot'. Am I mistaken?

Thanks, Rick, I did watch the video and don't quite understand how your statement about how the public folder "should not be inside public_html" given the attached screenshot.
 
image.png
In reply to Garth Brady

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Ken Task -
Picture of Particularly helpful Moodlers

Am confused about the 'old_subdir' ... and you might too in future.  But that is the currently active moodle code base right?

But what you did might be the only way if where you host won't allow symlinks outside of document root (very restrictive 'open_base_directory').

'SoS', Ken

In reply to Ken Task

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Garth Brady -
Picture of Particularly helpful Moodlers
"what you did might be the only way if where you host won't allow symlinks outside of document root"

Well, I could move the moodle folder back to:
/username/moodle

and then point
/username/public_html/subdir -> /username/moodle/public but then public wouldn't be web accessible (maybe? I'm not really sure as it would be outside the 'public_html' folder (so I assume not!?)
In reply to Garth Brady

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Garth Brady -
Picture of Particularly helpful Moodlers
Thanks All for your input... In the end, it turns out my host does allow me to create symlinks outside the webroot so I ended up moving my moodle folder outside of public_html and creating a symlink that points my subdomain to the /public portion of the moodle codebase.

Sorry for the trouble everyone... I don't quite understand how/why the symlink has access to files/folders outside the webroot but I'll figure it out eventually, I'm sure.
In reply to Garth Brady

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
Well, Garth, having read this post and your others, it looks like things have come together.

I can add a few more thoughts.

You are correct, that it would seem that if the moodle/public folder is outside of public_html, that it would not be "web accessible." Not being a web server expert, I thought the very same thing. How could this work? But that symlink file, since it is inside public_html, is like a magic door to the moodle/public folder. Perhaps someone can provide more technical details, but it works. This is the first time that I have ever seen this happen. Like "magic."  Maybe someday I will figure it out, too, but until then, I'll accept that it works.
 
(Something similar happens to the moodledata folder, too, which should be outside public_html.  How does the Moodle application access data that is outside of web root?  I never worried about the mechanism for this; I just accepted that it worked.)

When considering a computer's folder structure, there are different ways to describe where a folder is. Is it inside, outside, within, above, below, a level up, a level down, etc. So, considering that a computer's storage is like a physical file cabinet, it is easy to envision many hanging folders in a drawer, and then placing other hanging folders outside each other, and a folder inside a hanging folder. If you have any thoughts about how to say this better, I would like to hear them.
 
In summary, I would say, "Great work, Garth."  I can't give you a prize, just congratulations.
In reply to Rick Jerz

moodle 5.0.x -> 5.1.x upgrade pathing question (subdomain)

by Garth Brady -
Picture of Particularly helpful Moodlers
At this point, I'll settle for the congratulations smile Thanks for the assistance!
Average of ratings: Useful (1)