I set up my first website using WordPress way back around 2007 or 2008. I was amazed by the simplicity to install WordPress. My website was up and running within 2 minutes. Even now, the setup process remains the same. In this post, I’m sharing my WordPress setup.
Hosting
This entire website is hosted at Linode.com. Linode gives a 2GB RAM with a 50GB SSD and 2TB transfer for $10 per month.
Webserver
Since I don’t expect huge traffic to my website, I’ve preferred Apache to Nginx. Setting up a PHP application is a lot easier than setting up under Nginx. Nginx comes up with the weird fpm setup. While Nginx would’ve been my first preference for a high-scale web application, apache + php is still the best for small and simple web applications.
This is the simple Apache configuration I maintain for every single instance of the website I maintain.
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/sp2hari/html
ServerName sp2hari.com
ServerAlias www.sp2hari.com
<Directory /var/www/sp2hari/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from All
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/sp2hari.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/sp2hari.com/privkey.pem
</VirtualHost>
</IfModule>
SSL Setup
Let’s Encrypt for the win. All the website I host in my website (multiple WordPress servers) use lets encrypt for their SSL.
Managing Installation
wp-cli is a huge blessing. Before wp-cli, one of the biggest challenges with WordPress is that to install/upgrade plugins and themes, you had two choices.
- Make the wp-content (or just the plugins & themes) folder apache writable
- Install an FTP server and provide the FTP credentials.
Both of them are equally horrible and had lots of security concerns. WordPress CLI solved this in the best way possible. These days all the WordPress instances (including the home page of hackerrank.com) are WordPress managed by wp-cli.
Plugins
These are the set of plugins I have in the WordPress setup I have.
- Akismet Anti-Spam – Reduce the spam content in the contents.
- Captcha – Avoid brute-force logins
- Comet Cache – The best cache plugin with the best configurable options.
- Fonts Plugin – Easy way to configure custom fonts from Google Fonts
- Foobox Image Lightbox – The default image upload of WordPress isn’t the best.
- FooGallery – Ability to add multiple images in a grid, slideshow, or gallery view.
- Gist Github Shortcode – Ability so how Github gist in WordPress
- Smush – Plugin to compress image
- SyntaxHighligher Evolved – Automated syntax highlighter for the code displayed in the blog
Themes
Along with the default template, I’ve used the Fluida template. While I don’t recommend the same theme for everyone, different people like different themes based on their personal choice. I recommend choosing a good template which is responsive, good widgets/components. I recommend installing the theme via wp-cli.
Code
Apart from the setup, WordPress is a great example for programmers to learn and understand code, design and architecture. Some of the core technical decisions of HackerRank are inspired from WordPress.