标签:needed robot case tor director continue url tin type
https://opensource.com/article/18/8/publish-wordpress-static-gitlab-pages-site
A long time ago, I set up a WordPress blog for a family member. There are lots of options these days, but back then there were few decent choices if you needed a web-based CMS with a WYSIWYG editor. An unfortunate side effect of things working well is that the blog has generated a lot of content over time. That means I was also regularly updating WordPress to protect against the exploits that are constantly popping up.
So I decided to convince the family member that switching to Hugo would be relatively easy, and the blog could then be hosted on GitLab. But trying to extract all that content and convert it to Markdown turned into a huge hassle. There were automated scripts that got me 95% there, but nothing worked perfectly. Manually updating all the posts was not something I wanted to do, so eventually, I gave up trying to move the blog.
Recently, I started thinking about this again and realized there was a solution I hadn‘t considered: I could continue maintaining the WordPress server but set it up to publish a static mirror and serve that with GitLab Pages (or GitHub Pages if you like). This would allow me to automate Let‘s Encrypt certificate renewals as well as eliminate the security concerns associated with hosting a WordPress site. This would, however, mean comments would stop working, but that feels like a minor loss in this case because the blog did not garner many comments.
Here‘s the solution I came up with, which so far seems to be working well:
wget
, update all links from "private" version to "public" version.git push
to publish the new content.These are the two scripts I use:
check-diff.sh
(called by cron every 15 minutes)
mirror.sh:
That‘s it! Now, when the blog is changed, within 15 minutes the site is mirrored to a static version and pushed up to the repo where it will be reflected in GitLab pages.
This concept could be extended a little further if you wanted to run WordPress locally. In that case, you would not need a server to host your WordPress blog; you could just run it on your local machine. In that scenario, there‘s no chance of your blog getting exploited. As long as you can run wget
against it locally, you could use the approach outlined above to have a WordPress site hosted on GitLab Pages.
How to publish a WordPress blog to a static GitLab Pages site
标签:needed robot case tor director continue url tin type
原文地址:https://www.cnblogs.com/0xcafedaddy/p/9645432.html