Give us a call: (800) 252-6164
How to make your website load in under 2 seconds using Apache, Nginx, Redis, PHP7, MySQL, and WordPress

Load Times Under 2s: Adding a WordPress Site

May 6, 2018 | By David Selden-Treiman | Filed in: hosting.

With our current setup, you should be able to add as many sites as you want to hosted on your server. Here’s how to add a WordPress one.

Adding the DNS Configuration

First up, we need to add your domain name to your DNS server, if you haven’t already. First, add your domain to the master zones file:

 

… add the following contents to the bottom of the file

 

Next, open the individual file:

 

… and, copy and paste the following code over to your DNS server, adjusting the serial and other records as needed.

You can adjust any of these records as needed (like the mail IP address), and add in any additional subdomains by listing:

 

below the records.

Now, test your configuration using

 

If you see an “OK” at the end, everything should be good to go. Once you get that, you can reload your DNS server.

 

… and check the status

 

If you see an “active (running)”. Everything should be loaded properly.

At this point, if you run, from a different computer (like your home one):

 

You should see your DNS records show up in the “Answer” section. Now, you can add hostnames in your domain name provider for “ns1” to [[Your IP Address]] and “ns2” to [[Your IP Address]] and then to point your domain’s nameservers to ns1.[[Your Domain Name]] and ns2.[[Your Domain Name]] .

Adding a Verified SSL Certificate

In order to avoid having a warning every time our site is loaded over TLS/HTTPS, we need to add a verified SSL certificate. Personally, I use either the 2- or 3-year wildcard certificates available through SSL2Buy, or a free Let’s Encrypt SSL certificate (they are essentially identical).

Manual Creation

First up, we need to generate a certificate signing request. To do this, run:

 

Follow the instructions to enter your organization’s and domain’s information. At this point, you should be able to print your CSR for generating your certificate file (.crt).

 

When you’re done with getting your certificate information (we need the section “—–BEGIN CERTIFICATE—–”), we can add it to the server. Open up the corresponding .crt file, and paste the contents.

 

In the case of AlphaSSL and some other certificate providers, you may need to add in an intermediate certificate. In my case, I added the intermediate certificate here: https://www.ssl2buy.com/wiki/alphassl-intermediate-root-ca-certificates to the end of the .crt file.

Same as with our self-signed certificate, we’re going to generate a Diffie-Hellman Group certificate

 

… and append it to our certificate file

 

Let’s Encrypt Free SSL Certificate

To install a free Let’s Encrypt certificate, first we will need to install the certbot (the tool that will help us verify the certificate.) To do this, run

 

You will need to copy the following script over to /var/local/src/authenticator.sh using

The script to copy:

And now you can generate the certificate:

 

This should auto-install and confirm your certificate.

Site Folder Setup

Now, we’re going to need to create a subfolder of the FTP server folder and link our domain directory to it. First, we need to create a subfolder:

 

… and change the permissions so that the vsftpd can access the folder.

 

Now, we need to create the link

 

… and change the permissions of the link so that the web server can access it.

 

At this point, if you upload a file (say test.php) via FTP to the [[Your Domain Name]] folder, you should be able to see it if you run:

 

Apache Configuration

Now, we need to add an Apache configuration file for the new site. Open a new file named /etc/httpd/conf.d/[[Your Domain Name]].conf

 

and copy in the following contents.

You may wish to change the ServerAdmin email address to your own, or leave it as is. At this point, you can test your Apache configuration using

 

… and if you see a “Syntax OK”, everything should be good to go. Now you can restart your Apache server and check the status.

 

If you see “active (running)”, everything should be good to go. If you have your web proxy ports open, you should be able to go to: http://[[Your Domain Name]]:8080/test.php and https://[[Your Domain Name]]:8081/test.php and see your test file (assuming you uploaded them).

Nginx Configuration

Finally, we can copy in our Nginx configuration. This mainly just specifies which of our previous files we need to include, and all of the settings for our site. Open /etc/nginx/conf.d/[[Your Domain Name]].conf

 

…and copy in the following configuration if you’re using a manual SSL certificate:

or if you’re using Let’s Encrypt:

 

You can test your configuration by running

 

You should see something like:

 

Indicating that everything is set up properly.

At this point, you should be able to restart you Nginx server:

 

… and check its status:

 

If you see “active (running)”, everything should be good to go. You should be able to go to: http://[[Your Domain Name]]/test.php and https://[[Your Domain Name]]/test.php and see your test file (assuming you uploaded them).

Uploading Your WordPress Site Files

To upload your MySQL database, export and download it as a single .sql file (the entire database). After you’ve downloaded it from your old server if needed, upload the file via FTP. Once you have the file uploaded, create a database via phpmyadmin with the same name as your old one. Once it’s uploaded, run on your server:

 

This should upload everything into your new MySQL database. To check, view the database in phpmyadmin, and see if all of the content is loaded properly.

To upload your WordPress site, you can simply upload your files via FTP to your server. They should be available immediately. At this point, if you go to https://[[Your Domain Name]]/ you should be able to view your website.

 

Automatic Installation?

If you like the result of the tutorial, but run into problems or would just like to have the work done automatically, we can help you with that. We have an automated script that can SSH into your server and run this tutorial from beginning to end (as long as it’s running CentOS 7). If you would like this done for you ($100), please contact us using the form below.

 

    Get Started







     


    Part 1: Introduction and Planning

    Why it’s important to have your pages load in under 2 seconds, and a plan of how we will set up and configure the server.

    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 2: Installing Software

    Initial setup of the server, including installing CentOS7, installing tools, installing SSH and SSL, enabling repositories, and installing support packages.

    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 3: MySQL, Apache, PHP7, & Composer
    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 4: PHPMyAdmin & Redis
    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 5: SSL Certificate & Apache Configuration
    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 6: FTP & DNS
    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 7: Installing Nginx
    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 8: Configuring Nginx
    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 9: Adding a WordPress Website

    How to add a WordPress website to the server including configuring the DNS Server, adding a verified SSL certificate, either manually or for free using Let’s Encrypt, setting up FTP for your site, configuring Apache, configuring Nginx, uploading your WordPress site files, and importing your MySQL database.

    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.

    Part 10: WordPress Website Speed Improvements

    Speeding up your WordPress installation using a Redis plugin and a caching plugin.

    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.


    David Selden-Treiman, Director of Operations at Potent Pages.

    David Selden-Treiman is Director of Operations and a project manager at Potent Pages. He specializes in custom web crawler development, website optimization, server management, web application development, and custom programming. Working at Potent Pages since 2012 and programming since 2003, David has extensive expertise solving problems using programming for dozens of clients. He also has extensive experience managing and optimizing servers, managing dozens of servers for both Potent Pages and other clients.


    Tags:

    Comments are closed here.

    What Is The Best Web Hosting Provider?

    Finding the best web hosting provider for your needs is an important step in optimizing your website. There's a lot to consider. Here are our basic recommendations:

    Simple Websites

    For simple websites, you have a lot of options. Most web hosts will do acceptably for a simple small-business website or blog.

    That said, we recommend avoiding website builders so that you maintain control of your website.

    VPS Hosting

    If you just need a simple VPS, most providers will work well. Different providers have different downtimes, but the big differentiators are cost.

    Providers like AWS and Google Cloud tend to be much more expensive than more specialized providers.

    We recommend Digital Ocean and Hetzner if you're looking for a good VPS provider at a good price (it's what we use.)

    High Performance Hosting

    If you're looking for high performance web hosting, you're going to need something more specialized.

    You can't just expect a simple cPanel host to give you what you'll need. You need a custom configuration.

    Generally, you'll need either a managed host, or you'll need to get your servers configured with custom configurations.

    If you're looking for a high performance hosting provider, we offer hosting designed for high-availability and high-traffic.

    WordPress Hosting

    What WordPress Hosting Should You Get?

    There are many considerations when getting a WordPress hosting provider. Focus on the performance needs of your website.

    WordPress Hosting Setup

    When setting up your WordPress hosting, or switching hosts, there are a number of steps to complete. These include:

    WordPress & Security

    There are a number of WordPress security threats to contend with. We recommend using a plugin like WordFence to help secure your site.

    WordPress Backups

    Make sure to also back-up your site. It's absolutely essential, and ideally use an off-site backup provider that's different from your hosting provider.

    WordPress Speed Improvements

    There are a number of ways to improve the speed of your WordPress site on its hosting.

    There are a number of plugins that can help improve your site's speed.

    DNS

    DNS Records

    There are many different types of records, each with their own purpose. These include: SOA, A, TXT, CNAME, PTR (reverse DNS), and more. On some servers, you can also set up wildcard records.

    The records you need will depend on what you're doing; WordPress sites require different records than mail servers, for example.

    Propagation

    The process of your records transmitting to DNS servers around the world is called propagation. It normally takes 48 hours, but you can speed it up a bit with some planning.

    Testing

    To test your DNS records, there are 2 main tools: dig and nslookup. Each is very helpful in its own specialty.

    Reliability & Security

    There are a number of ways to improve your DNS reliability and security.

    • Split Horizon allows you to separate networks, either for intranets or for separating by geographic region.
    • GeoDNS allows you to give different records to different locations based on the requesting IP address. This allows you to create your own CDN, speeding up your site.
    • DNS over QUIC speeds up your DNS requests and gives you better DNS security by encrypting your DNS connection.
    • DNSSEC allows you to sign and encrypt your DNS connection, ensuring that nobody is changing your records.
    • DNS over HTTPS allows your visitors to request your DNS records over an encrypted connection.

    Internationalized Domains

    Internationalized domain names allow character encodings other than Latin characters. They have their own methods for backward compatibility.

    Scroll To Top