Skip to content

Web Servers - 2. page

All things related to web servers.

How to move a WordPress site to a new server or host with no downtime

Yesterday, I finished building a new and improved WordPress server. This means I had to migrate the serenity-networks.com WordPress installation from the old server to the new. I wanted to do this with zero downtime, which is actually quite easy and straightforward if you have a plan in place. The process works something like this.

  • Export the database from the old server using phpmyadmin
  • Copy all WordPress files from the old server to the new server
  • Import the database on the new server using phpmyadmin
  • Add temporary hostname entry into your local hosts file

You might be asking yourself, why on earth would I add a hostname entry into the hosts file on my workstation? Well, this will allow you to pull your website from the new server without changing your public DNS settings. If you are only hosting one site on the new server, and not using virtual headers, you can skip this step if you like. So lets get it started.

Moving a WordPress site to a new server

The only real requirement, other than a server capable of running WordPress, is having phpmyadmin installed on both of your web servers. Most already do, but if you don’t, click here to learn how. We need this to export and import the WordPress database.

First, log into phpmyadmin on your old server so we can download the WordPress database. It should be pretty obvious which database is for your WordPress instance, but if you aren’t sure you can see the name of it by looking at the wp-config.php file, located in the root of your WordPress installation.

Select your database in the left column and then click the Export tab at the top of the right column. Leave the selection set as Quick, and click Go.

Click Here To Read The Rest!

How to build your own WPEngine copycat WordPress server on Ubuntu 14.04 with an Ansible Playbook

There is no denying that WPEngine offers the fastest WordPress hosting on planet earth. They’ve invested millions into building the fastest platform possible. That’s why they charge so much money for their services. Because they are worth it. Some of us can’t afford to pay $100-$1000/mo for WordPress hosting. The good news is that if you’re not afraid to get your hands dirty on a Linux command line, you can build your own server that will get you most of the way to a WPEngine class WordPress instance. There are a few key technologies that make this possible.

  • Percona DB (like MySQL)
  • HHVM – A super fast PHP VM
  • PHP-FPM – Just in case HHVM has a problem
  • NGINX
  • Varnish – Awesome reverse proxy cache
  • Memcached & APC

I think you’re probably starting to get the idea. These are the highest performers of the high performance technologies out there. We’re going to make them all work together to make your site blazing fast. It’s not all that hard and it doesn’t take very long.

All you need is a VPS or Virtual Machine running Ubuntu 14.04. Go ahead and SSH into it and we’ll get started.

How to build a WPEngine copycat server for FREE

The server you are working with MUST be able to resolve the hostnames of the sites you’re going to set up, to itself. So, if you are building this to replace a server that’s running and you don’t want to take that site down until everything is migrated, simply add hostname entries mapping the FQDN to the IP address in /etc/hosts.

First thing’s first, let’s make sure your Ubuntu 14.04 installation is updated and upgraded.

sudo apt-get update && sudo apt-get upgrade

Now we need to add the Ansible ppa.

sudo add-apt-repository ppa:ansible/ansible

Click Here To Read The Rest Of This Post!

How To Build An INSANELY FAST WordPress Server On Ubuntu 14.04, Using NGINX, HHVM & MySQL

So, you want to build a WordPress server? One that won’t barf all over itself every time a link is posted to Digg or Reddit? Well, you’ve come to the right place. Building an insanely fast web server isn’t rocket science. It’s actually pretty darn straight forward. I’ve built more web servers than I care to remember, which means I’ve also made more mistakes I care to remember. All in the name of trying to make things faster. If speed is your goal, there’s only a few important key things to remember. If speed is absolutely the most critical variable in a situation, my philosophy is something like this:

  • KISS – Keep It Simple Stupid. Seriously… No control panels, plugins, or other bloated garbage.
  • Cache, Cache, and Cache some more. Caching is a godsend. Reduces requests, reduces transfer time, therefore reducing load times!
  • FAST Server – This should be a given, but no shared servers. Only VPS, VM or bare metal awesomeness.
  • Optimization – Optimize, minimize, downsize, and compress everything as much as you can get away with.
  • Optionally, using a CDN (Content Delivery Network) can really speed things up; as well as a high quality distributed DNS service. But, not absolutely necessary.

Like I said, we’re talking about building an INSANELY FAST WordPress server here. Obviously if you’re Joe Shmoe from Motown, you can probably get by just fine on a quality managed hosting provider, like Serenity-Networks. But, if you want to build the fastest web server on earth, continue reading.

There are plenty of Linux Distributions out there that will work just fine. I prefer CentOS and Ubuntu. For this guide, I’ll be using Ubuntu 14.04 LTS (Long Term Support). This OS will be supported for many years, with security updates. That’s good, especially for a server. If you don’t have it, go to http://www.ubuntu.org and go to downloads, then server. Be sure to select the 14.04 LTS version.

Now, assuming you have done a minimal install of Ubuntu 14.04, with only OpenSSH selected for packages (for remote SSH connection, obviously), we will be using some commonly known building blocks to turn this into a very fast web server.

  • NGINX Web Server – Many THOUSANDS of the fastest sites in the world use it. It’s the best.
  • HHVM – This is a very high performance virtual machine that takes care of processing PHP (as well as HACK). Because it turns PHP into machine language, very quickly, it can really speed things up.
  • MySQL – Kind of boring, but every site needs a database, so we’ll use this one.

Getting Started

Click Here To View The Entire Tutorial!

How to Install Docker on CentOS 7 and Set Up A Ghost Blog

Docker is a slick container based virtualization platform that allows you to run “images,” with minimal overhead. There are many different images available, from full blown OS’s, such as Ubuntu or CentOS, to web apps like WordPress or Ghost. The possibilities are endless, and because resource usage is minimal, you can really do a lot with little resources. You can install docker on all of the major linux distributions, as well as windows. I works fine in a virtual machine, or VPS. I will be installing Docker on a CentOS 7 VM, running on an ESXi hypervisor.

Lets Get Started

I’m assuming you already have your operating system installed, you are sitting at a command prompt. Installation and configuration is very easy on CentOS 7. By default, CentOS uses firewalld. Docker and firewalld do not get along nicely. Docker creates iptables rules directly for access to running containers, and if firewalld is refreshed or restarted, all of the iptables rules docker initiated get wiped by firewalld. So, we will disable firewalld and install the classic iptables functionality. Here are the steps involved:

  • Install Docker
  • Disable firewalld
  • Install iptables configuration scripts
  • Download Ghost Docker image and run

First, we will go ahead and install Docker. To do this only requires a single, simple command.

#  sudo yum install docker

Let’s set up Docker to start at boot time.

#  sudo chkconfig docker on

There will be a handful of dependencies, nothing out of the ordinary. If you are already running as root, you can omit the sudo. Next, we need to get firewalld stopped, removed, and iptables configuration scripts installed.

Click Here To Read The Entire Tutorial!

Tons and tons of awesome links

I always come across pages, links, and things that I don’t want to forget about, and I want to share with the world. So, I decided to create a post with nothing but links. From time to time I will update this post with new links. I’ve tried to categorize everything as much as possible. Be sure to hit the break below to get the full list. Enjoy!

Web Development – Coding, Design, Templates, Etc.

HTML5 Boilerplate – HTML5 Front-End Template  –  http://html5boilerplate.com/

Initializr – HTML5 Template Generator (Based on Biolerplate)  –  http://www.initializr.com/

Smashing Magazine Freebie Icons  –  http://www.smashingmagazine.com/tag/icons/

1001 Free Fonts  –  http://www.1001freefonts.com/

 

Web Hosting – Control Panels, Web Servers, Modules, Etc.

Kloxo – Fully featured hosting control panel (like directadmin/cpanel)  –  http://lxcenter.org/software/kloxo/

ZPanelCP – Fully featured hosting control panel that supports linux as well as Windows (LAMP)  –  http://www.zpanelcp.com/about/

Click here to keep reading this post

How to install Fail2Ban on CentOS 7 – Step by Step Guide

This is a how to on installing Fail2Ban on CentOS 7.  Fail2Ban is an incredibly useful, and often necessary, package that will automatically block IP addresses attempting to brute-force attack your server(s). For instance, with Fail2Ban installed, if an IP address attempts to brute-force login user “root” on your server, one a certain number of attempted logins is reached within a designated time period, it will automatically insert an IPtables rule into your firewall to block all access from that IP address for a specified period of time. Of course, you set all of these variables in the configuration file, which I’ll go into later on. I have yet to have a public facing server be online more than a day before a brute force attack of some sort is encountered. The best practice is to use secure passwords, with upper case, lower case, numbers and a few symbols. Never use dictionary based passwords. With effective, secure passwords it would take a very, very long time to gain access to a server by means of brute force, but it is possible. Regardless, it’s best to block these attacks from the beginning. It is all automated with Fail2Ban.

This guide assumes you have a CentOS 7 installation and have ran yum update.  It requires you have root SSH access to the server.

First, you need to install the EPEL repository.  Fail2Ban is not available from CentOS, with the available repositories.

cd /tmp

rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/epel-release-7-5.noarch.rpm

Click here to keep reading this post