How to Setup Web Server for High Traffic Site With $10 VPS

MyHowTo
How to Install and Configure Web Server for High Traffic Site Only With $10 Linux VPS
How to Install and Configure Web Server for High Traffic Site Only With $10 Linux VPS

Intro

Hello everyone. This will be my first post and How-To tutorials on this website. As someone who is still learning English, forgive me if my English is bad.

If you access this website, are you aware that loading is not too long? Compared to websites hosted on Web Hosting with cPanel. That can take a few seconds longer. Read this article carefully so you can have a fast web server like this.
That’s why I don’t use Web Hosting anymore. I only spent a little extra to get a web server that was as fast as I wanted.

Advertisements

In this article I will make a tutorial on how I only use $10 VPS for websites that have high traffic. In the past, I used Web Hosting and cPanel. But it’s very annoying when loading my website. It takes almost 1 minute! Yes, that’s because of Shared Web Hosting. After I learned a little about Ubuntu (Linux) and learned the simplest way to setup a Web Server on a newly installed Linux OS on a VPS, the results were amazing.

Of course this tutorial is only for people who want to learn more about Web Server or you can bookmark this article and follow the tutorial from the beginning for every time you want to setup a new Web Server.

Let’s Start!

In order to successfully setup according to the tutorial in this article, please read everything carefully.

Create New VPS on Vultr

I will use $10 VPS from Vultr.
Server Location: New York (NJ)
Server Type: Ubuntu 16.04 x64
Server Size: 40GB SSD ($10/Month)

It will look like this.

Deployed $10 VPS on Vultr
Deployed $10 VPS on Vultr

Upgrade Your Server First

PuTTY Upgrade Software or Kernel on The Server
PuTTY Upgrade Software or Kernel on The Server

Login to your server with PuTTY and you need to update your server first.
Run this command:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt autoremove
reboot

Do you want to continue? [Y/n] y
Always type “y” or “Y” and press Enter.

The command itself is to upgrade the software/kernel to the most recent one on the server and then completely remove the old or unused software/kernel. After that we reboot our server just to make sure everything has been upgraded.

Update Your Password

Update VPS Password
Update VPS Password

For your security, you need to update your password now using a password that is very strong and hard to guess. The process is very simple. Just type this command:

passwd

New password:
Retype new password:
passwd: password updated successfully

Type your new password twice and you’re done here.

Install New Packages

PuTTY Install New Packages on The Server
PuTTY Install New Packages on The Server

I always install this packages before setup my web server. Sometimes we need this packages in the future if we want to install addons or something on our server.

sudo apt-get install build-essential libtool autotools-dev autoconf automake cmake pkg-config libssl-dev bsdmainutils libevent-dev libgmp-dev libgmp3-dev


sudo apt-get install libboost-all-dev


sudo apt-get install linux-headers-$(uname -r)


sudo apt-get install software-properties-common


sudo apt-get install python-software-properties python-dev


sudo apt-get install zip git screen wget nano bzip2 xdelta3 libpthread-stubs0-dev zlib1g-dev zlib1g pciutils pciutils-dev curl perl


sudo apt-get install libcurl4-openssl-dev libncurses5-dev yasm libjansson-dev libpcre3-dev

wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm -rf get-pip.py

reboot

Do you want to continue? [Y/n] y
Always type “y” or “Y” and press Enter.

Install the new package and reboot the server again. Now your server is completely ready to continue with the web server setup.

Setup Web Server

Now it’s time to install the web server. I will try to explain step by step.
Login to your server again using PuTTY.
And run this command:

git clone https://github.com/lj2007331/lnmp.git

cd lnmp

./install.sh

We will configure the web server configuration. Follow using the example that I use to make it easier.

Please input SSH port(Default: 22):

Just press enter. If you want to change your SSH port, maybe you need to fill this question with your new SSH port.

Do you want to enable iptables? [y/n]: y

I choose Y or Yes. Because this option will only open port 22 (SSH), 80 (HTTP) and 443 (HTTPS) on your server. For your security (maybe).

Do you want to install Web server? [y/n]: y

Yes. No more explanation is needed about this.

Please select Nginx server:
1. Install Nginx
2. Install Tengine
3. Install OpenResty
4. Do not install
Please input a number:(Default 1 press Enter)

Choose 1 or just press enter without entering a number. 

Please select Apache server:
1. Install Apache-2.4
2. Install Apache-2.2
3. Do not install
Please input a number:(Default 3 press Enter) 3

I prefer not to install Apache. Because in my opinion Nginx is the best choice for the speed of your website. So I prefer number 3.

Please select a version of the Database:
1. Install MySQL-8.0
2. Install MySQL-5.7
3. Install MySQL-5.6
4. Install MySQL-5.5
5. Install MariaDB-10.3
6. Install MariaDB-10.2
7. Install MariaDB-10.1
8. Install MariaDB-10.0
9. Install MariaDB-5.5
10. Install Percona-5.7
11. Install Percona-5.6
12. Install Percona-5.5
13. Install AliSQL-5.6
14. Install PostgreSQL
15. Install MongoDB
Please input a number:(Default 2 press Enter) 5
Please input the root password of MySQL(default: TkDaiOgU): tutorials

Because MariaDB is claimed to be faster and better than MySQL, so I chose number 5 (the latest version of MariaDB). Always select the latest MariaDB version.
Type the password for your root database. Use a secure password. In this example I use the password “tutorials”.

Please choose installation of the database:
1. Install database from binary package.
2. Install database from source package.
Please input a number:(Default 1 press Enter)

Default press enter or number 1. I install database server from binary package.

PLEASE READ: If you want to use an old PHP script, there might be a lot of errors on your website. So, the best choice if using an old PHP script is to use MySQL version 5.5 or 5.6.

Please select a version of the PHP:
1. Install php-5.3
2. Install php-5.4
3. Install php-5.5
4. Install php-5.6
5. Install php-7.0
6. Install php-7.1
7. Install php-7.2
Please input a number:(Default 5 press Enter) 7

I chose PHP 7.2 (number 7) because this is the most recent version of PHP and claimed to be faster than the PHP 5 version.

PLEASE READ: If you want to use an old PHP script, there might be a lot of errors on your website. So, the best choice if using an old PHP script is to use PHP version 5.5 or 5.6.

Do you want to install opcode cache of the PHP? [y/n]: y

This one is only optional if you want to use caching on your server. Sometimes I choose No. Because this is very annoying after updating your website. This will display the old version of your website after you update something and you cannot see the latest updates from your website. So you have to clear the cache on your website every time you make an update. Like updating themes, widgets, edit posts, and others.
You can choose Yes or No.

Do you want to install ionCube? [y/n]: y

Sometimes, if you buy a PHP script or plugin, the seller will provide the version that has been encrypted. So, you need ionCube installed to make it work. So that there are no problems in the future.

Do you want to install ImageMagick or GraphicsMagick? [y/n]: n

Not really needed ImageMagick or GraphicsMagick. If it’s really needed, choose Yes or you can install this later via addons.sh in the “lnmp” directory.

Do you want to install Pure-FTPd? [y/n]: n

Optional. I chose No to install FTP. Because I use WinSCP to upload, download and modify files from PC to server.

Do you want to install phpMyAdmin? [y/n]: n

Optional. I choose No. Managing the database on your server that can be accessed via the website is a little dangerous. Maybe Bad Guys will use this to gain access to your database. Except, you know how to secure it.

Do you want to install redis? [y/n]: n
Do you want to install memcached? [y/n]: n
Do you want to install HHVM? [y/n]: n

Don’t need Redis, Memcached and HHVM for now. But this depends on your needs. I choose No.

Now we are done with the settings. My settings look like this.

Settings to Setup Web Server for High Traffic
Settings to Setup Web Server for High Traffic

Press enter and the installation process will run. It takes a few minutes to complete. Just wait.
Don’t close PuTTY or disconnect from your internet connection. Because the installation process will be canceled.

If the installation is successful, you will see it as shown below.

Install Web Server Successfully
Install Web Server Successfully

Do you want to restart OS ? [y/n]: y

Yes. You should restart your VPS.

After restart, login again to your server. Go to “lnmp” folder again and we will use addons.sh this time. Of course with root user.

cd /root/lnmp
./addons.sh

Install PHP Extension

We will install fileinfo PHP Extension. Type number 4.
Select an action: Install (Just press enter)
Select fileinfo/imap: 1. fileinfo (Just press enter)

What Are You Doing?
1. Install/Uninstall PHP opcode cache
2. Install/Uninstall ZendGuardLoader/ionCube PHP Extension
3. Install/Uninstall ImageMagick/GraphicsMagick PHP Extension
4. Install/Uninstall fileinfo/imap PHP Extension
5. Install/Uninstall memcached/memcache
6. Install/Uninstall Redis
7. Install/Uninstall swoole PHP Extension
8. Install/Uninstall xdebug PHP Extension
9. Install/Uninstall PHP Composer
10. Install/Uninstall fail2ban
11. Install/Uninstall ngx_lua_waf
q. Exit
Please input the correct option: 4


Please select an action:
1. install
2. uninstall
Please input a number:(Default 1 press Enter)


Please select fileinfo/imap:
1. fileinfo
2. imap
Please input a number:(Default 1 press Enter)

After “fileinfo” PHP Extension is installed, the web server installation is complete. Try accessing your Web Server using your VPS public IP address.

http://YOUR_VPS_PUBLIC_IP

Access prober.php file: http://YOUR_VPS_PUBLIC_IP/prober.php

It will look like this.

Advertisements
Install Web Server on VPS Completed
Install Web Server on VPS Completed

Benchmark

This is the result of my benchmark using Loader.io By sending 2500 visitors/sec to blank html page for 20 seconds. The response is very stable at an average of 7ms and does not take up a lot of resources.

Benchmark $10 VPS From DigitalOcean
Benchmark $10 VPS From DigitalOcean

Now we have finished installing the Web Server on our VPS. In the next article, we will see how to add a domain on a Web Server, using SSL/HTTPS for free on our domain and setting up a DNS domain to make it accessible.

Leave a Reply

Your email address will not be published. Required fields are marked *

Sign Up for Our Newsletters

Get notified for our new articles.

You May Also Like
How to Delete WhatsApp Data From Google Drive

How to Delete WhatsApp Data From Google Drive

WhatsApp Messenger is a cross platform messaging and VOIP service which is owned by Facebook and it allows you to send voice calls and text message as well as images,…