I have a Hugo static website and I would like to host it on netlify or Forestry due to performance. However, I want to integrate a PHP based forum engine (Flarum) within the site like, domain.com/forum. The mentioned two is for only static site, not php.
How can I solve this? The easiest would be a VPS, I know, but I have no experience in it.
Hi. It may not be possible on those services.
I use PHP for the following script on my website: https://www.psychedelicsdaily.com/MushroomCalculator.php?wet=1&mao=0
This script goes in /static/ directory in my Hugo project, and I just make an AJAX call to this script.
Then on server, of course you’d have to configure PHP env.
You could put the PHP software in /static and host it there, if you are hosting yourself on a VPS or something.
Since you want to host on Netlify or Forestry, they are I think static site hosts only, and probably do not allow php or python or a back-end.
This maybe of more help: https://community.netlify.com/t/common-issue-can-i-run-a-web-server-http-listener-and-or-database-at-netlify/3078
You can host the forum elsewhere, and link to it. You can put it on a VPS on forum.domain.com etc. or forward domain.com/forum to that forum host.
This isn’t really a hugo thing.
As you’ve already mentioned, Netlify is for static sites only, so it doesn’t have a PHP interpreter connected to its web server. Forestry.io doesn’t host anything, it’s a frontend for SSGs.
What I’d do is run your PHP software on a different system (a VPS or web host which provides dynamic tools like a database, PHP, CGI etc.). And make
domain.com/forum redirect to your forum, by creating a file -
static/forum.html - and use html redirection to send visitors to your forum.
Hash, funkydan, thank you very much for your reply!
Thanks for the idea, I would go for the idea that host the forum elsewhere and forward the visitors over there.
Btw. What’s your opinion about netlify, forestry? Which one do you guys prefer? What the benefit comparing to a digitalOcean VPS for instance?
Netlify and Forestry are two different tools.
Netlify is a hosting platform. (They also have an open sourced Content Management System.) The benefit over a VPS would be price and ease of use - they’ve got all the things you need for running a Jamstack site baked in.
Forestry is a content management system.
I use Netlify to host a few sites. And I’ve gone with forestry as my CMS of choice…though in my current workflow I generally use command line tools on my local machine.
Put the forum on a sub domain like forum.domain.com and host it somewhere else instead. Then simple add links between them. This will be far easier and allows each system and host to do what they are best at.
Thank you, I will do it! However, the sub domain is better from SEO perspective than domain.com/forum? As far as I know, it’s not better, even worse and need to stick to /forum structure. What do you think?
There’s no clear answer here. Some SEOs will argue that it’s better to do one over the other.
Google’s smart enough to realize they’re both part of the same entity, with some caveats. See this YouTube video from Google.
Hugo’s forum isn’t the best place to for SEO questions. Feel free to DM me if you have more questions and I’ll try to help.
Thanks for your feedback guys! Angel, I have a question, if you don’t mind, I’ll ping you. How can I reach you out?
On discourse you can DM someone by clicking their name and message. Just sent you a note. Best of luck