The self-hosted software gives you more control and offers a lot more flexibility. It also lets you run the advertising services you want to use. Running the commercial offering won’t cost you a thing unless you want more than the basics. Self-hosting isn’t terribly expensive until your website gets extremely popular. Done correctly, it won’t ever get expensive.
To run WordPress, you need a web server, PHP-FPM and MySQL (or MariaDB, preferably). Both Apache and Nginx are well-supported web servers and I’m sure it’ll run with others (most people start with Apache). I already wrote about setting up the required daemons on an Ubuntu server. The self-hosted software website can take you through installing WordPress as well as its first configuration, step-by-step if necessary.
To get WordPress working well with Nginx, the page for it at WordPress.org provides a lot of details on how to configure it properly. If you want it work better, you should read this article published by an nginx.com writer.
By default, the pages and posts are served dynamically through PHP. This works fine until you get more than a few posts published. The database is the biggest bottleneck even though a single-page object cache exists. If you leave it set up this way, you’ll find your memory usage going through the roof and your speed decreasing.
To get better and faster performance, you need a persistent object cache (like APCu, Memcached, XCache or Redis) and a full-page cache (like WP Super Cache, W3 Total Cache, Hyper Cache or Comet Cache). Some of the full-page caching plugins configure a persistent object cache, but not many.
The best full-page caching plugins don’t access PHP at all on the cached, static pages. That means the database isn’t accessed either. Page speed is important and the time to first byte is important.
I wrote my custom caching script to bypass WordPress completely for visitors. The back-end administration functions as normal. The caching script is activated by a real cron job. It runs every minute but exits immediately if there aren’t any cached pages to create or update.
Years ago, a mail server was a necessity. Today, it’s only necessary for branding purposes, with your domain name as part of the e-mail addresses being used. Even so, you don’t actually have to install a mail server because Google and other entities will do e-mail hosting for you.
If you install a mail server, it’s actually a two-part system. One daemon is for receiving and one is for sending. With WordPress, you only need to send and you can do that with msmtp, an SMTP client. To install it:
apt install msmtp msmtp-mta
Edit the configuration file:
You can read the documentation, but use these lines for gmail:
defaults tls on tls_starttls on tls_trust_file /path-to/ca-certificates.crt account default host smtp.gmail.com port 587 auth on user email@example.com password yourpassword from firstname.lastname@example.org logfile /var/log/msmtp.log
The tls_trust_file for Debian, Ubuntu and other Debian derivatives is “/etc/ssl/certs/ca-certificates.crt”. Once you verify everything’s working, you can put a “#” in front of the log file line.
As far as mail server ports go, the only one I have open is 587 (TCP out). I’ve been receiving my website mail for years doing it this way.
Previous and Next Articles (if any):