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

Load Times Under 2s: FTP & DNS

May 6, 2018 | By admin | Filed in: hosting.

Installing an FTP server

Next we’re going to want to install an FTP server so you can upload files. To do this will be using vsftpd. This is an FTP server that allows you to upload files just like any other FTP system. It’s pretty easy to install but we’re going to add some specializations to it. Our system will allow you to add and edit users using a my sequel database table, and will upload files into their specific folder. In order for the web server to access these files will simply create a soft link from the web server location to the FTP server location. The trick will be to get the permissions correct.

First you need to install vsftpd.

 

Next we need to install a user specifically for the vsftpd process.

 

We’re going to add the vsftpd user to the Apache group so that files uploaded to the web server folder can be accessed by vsftpd.

 

Now we need open the settings configurations.

 

… and add in the configurations file:

 

Now we’re going to make a directory for our FTP files to be uploaded to. We also need to set the permissions so that the vsftpd user (the program) can control the folder.

 

Now we need to copy the PAM MySQL authentication settings. This is what will allow us to add FTP users via to MySQL tables.

 

Now we need to edit the configuration file

 

…and add in the following lines. You will need to set your own vsftpd user password.

 

Now we need to create the vsftpd user in the MySQL database.

 

At this point we can install the pam_mysql authentication package.

 

At this point, the MySQL authentication should be installed and the FTP user system should be installed. We can now create a test user. All user folders will be stored in the /var/www/ftp/ folder. We can link the folders to the web ones, giving our web servers access to the FTP files.

 

Now we can enable and start our vsftpd process. You should be able to see that the process is running without any errors with the last status line.

 

If you have SELinux, we will need to set a bool that will allow the vsftpd process to access the required directories:

 

Now at this point if you connect to your FTP server you should be able to upload files directly to the server and view them at:
https://[[Your IP address]]:8081/test_folder

Installing a DNS server

Now we need to set up a DNS server. This will allow you to point your domain name directly to your server. The DNS server will allow you to direct your visitors to each subdomain that your site has. This is great for mail, for FTP, and for websites.

First we need to install bind.

 

Next we need to enable it.

 

And now we need to set up the firewall to allow DNS traffic.

 

We need to make some changes to the /etc/named.conf configuration file.

 

Set:
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };

Next we need to set up our main DNS zones file and the individual configuration files. First we will copy the original main configuration file for posterity.

 

And we need to add our domain name to the main file.

 

… add the following contents to the bottom of the file

 

Next we need to create your individual Zone file.

 

… and add in the following contents. Feel free to make any changes, as required on your site.

 

Now we can start the DNS server.

 

If everything worked correctly, you shouldn’t see any error messages. Assuming you did not get any error messages, you can run the following command to test your DNS server.

 

If at any point you need to reload your DNS zones you can simply run the following command without restarting your DNS server.

 

Finally we need to tell your server to access its own DNS for any lookups.

 

… add the following lines.

 

… and restart your DNS server

 

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.

Part 2: Installing Software

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

Part 3: MySQL, Apache, PHP7, & Composer

Installation of MySQL database serverApache web serverPHP, and Composer package manager for PHP

Part 4: PHPMyAdmin & Redis

How to download, install, and configure PHPMyAdmin; How to install and configure Redis

How to create a self-signed SSL certificate; how to configure Apache as a PHP backend

Part 6: FTP & DNS

How to install and configure an FTP server with dynamic users; how to set up a DNS server

Part 7: Installing Nginx

How to download, build, and install Nginx with additional modules

Part 8: Configuring Nginx

How to set up Nginx configuration files including (with explanations): nginx.confGzip compression settingsvisitor browser caching settingsSSL settingsreverse proxy settings for sending data to the Apache serverreverse proxy connection configurationsfile access restrictions, and WordPress configuration settings

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.

Part 10: WordPress Website Speed Improvements

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



Tags:

Comments are closed here.

Scroll To Top