How to Install VestaCP with Nginx + PHP-fpm
VestaCP is known nowadays as the best free and easy to use hosting control panel (according on me). Well, as you may know that by default Vestacp implements Nginx as frontend webserver while makes use of Apache as backend. This becomes the most common configuration allowing its users to enjoy the speed of Nginx –in delivering static contents– while also the easiness and flexibility of Apache.
In today’s guide, I’m going to show you how to install Vestacp with Nginx and PHP-fpm, instead of with Nginx, Apache and PHP5, on your VPS (Ubuntu or CentOS server). In addition, there are also few results of performance benchmark test so you can estimate how powerful it is to build a hosting server powered with Vestacp, Nginx, and PHP-fpm on a 512MB RAM server. Are your curious enough? Get Ready!
- A SSH client like Bitvise or Putty and basic knowledge about how to use it.
- Basic knowledge about common Unix command to SSH to your server.
- A server or VPS with at least 512MB of RAM (1GB or more is recommended).
- About 30 minutes of your time
- a cup of coffee or tea.
Confused on choosing which VPS provider to install VestaCP? Read my recommended VPS providers or top low end cloud server providers. Quick recommendation: Digital Ocean, Atlantic.net or Ramnode.
In this guide I’m using a 512MB RAM Cloud VPS from Digital Ocean running Ubuntu 15.10 x64. You can use steps below on CentOS and any Ubuntu versions which are supported by Vestacp.
Step 1 – Login to your server via Putty (or any SSH client) as root or as user with root privilege (sudo).
Step 2 – Now open up your favorite web browser (e.g: Firefox, Chrome, IE), then visit vestacp.com. Scroll down the page a little bit and find the Advanced Install Settings section. Choose nginx + php-fpm from the dropdown menu.
Step 3 – Because Vestacp doesn’t come with File Manager (unless you buy its license), so you better also choose which FTP server you prefer to install: vsftpd or proftpd. It is necessary for you to easily transfer and manage your site’s files and folders.
Step 4 – Next, if you also planned your server to host your email so you can have your own firstname.lastname@example.org for instance, then also choose which mail server and its necessary software to install. The least and common things to install are exim and dovecot but you can also install spamassassin and/or clamav.
Step 5 – Regarding DNS, you have only two options: either to use NAMED or use no DNS at all. As per my example, I simply chose to use no DNS because I’m going to use default Namecheap DNS Management features. Also, reducing one or more component can help save my server’s RAM usage.
Step 6 – Next is firewall, you can choose whether to use iptables and fail2ban, iptables only or no firewall at all. In my case, I decided to use iptables and fail2ban. It is the safest scenario.
Step 7 – Also, you can choose either MySQL or PostgreSQL as your database engine. In fact, you can -if you want- to choose both of them as well as none of them. It just depends on your need, but if you plan to install WordPress then you are going to need MySQL.
Step 8 – Additional repository part is just an optional but if you are on CentOS, you should better to install it. Remi repo provides lot more awesomeness. There are many additional packages there.
Step 9 – For the File System Quota, I really suggest you to simply choose no especially if you are going to use your server alone. I mean, if you are not going to use it as Shared Web Hosting service so what’s the point of System Quota anyway. But however the choice is up to you.
Step 10 – Next, type in your server hostname: using valid FQDN is strongly recommended. Also, do not forget to type your email and password. It is not your email password but the password for admin account used to login to Vestacp.
Step 11 – Finally, do not forget to click on the green “Generate Install Command” button.
Step 12 – You’ll then get few lines of install command. Just copy that code.
The code is something like this one below. Tips: You can simply copy the code below actually, but I still told you how’s the process (above) to get the code so you can modify it according to your need:
bash vst-install.sh --nginx yes --phpfpm yes --apache no --vsftpd yes --proftpd no --exim yes --dovecot yes --spamassassin yes --clamav no --named no --iptables yes --fail2ban yes --mysql yes --postgresql no --remi yes --quota no --hostname your.hostname.com --email email@example.com --password yourpassword
**replace your.hostname.com, firstname.lastname@example.org and yourpassword with your own.
Step 13 – Go back to Terminal / Putty window. Now execute the command below to download Vestacp installation file:
curl -O http://vestacp.com/pub/vst-install.sh
If you are also using DigitalOcean droplet and running Ubuntu, most likely you’ll get curl is not currently installed. It means you have to firstly install it using command : apt-get install curl
Step 14 – Now you can paste the install command copied earlier (in Steps 12) there then hit Enter to execute it.
Step 15 – You’ll then be asked “Would you like to continue” so simply type y then hit Enter.
Step 16 – Sit tight and wait till the install process is complete. At the end of the process, you should see something like this :
Step 17 – That’s it. You can now login to your Vesta Dashboard page via web browser by typing :
replace x.x.x.x with your server IP address. Use admin as username and use the password you defined earlier.
Vestacp dashboard page:
That’s it. Also read :
- How to add new website on Vestacp
- How to install wordpress on Vestacp
- How to find out MySQL root password on Vestacp
Performance of VestaCP Nginx + PHP-fpm
I posted several benchmark like how Vestacp with PHP7 performs either on Ubuntu and CentOS. So just in case if you are so curious about the performance of VestaCP nginx + php-fpm, here’s I’ll show you the result I got by using several tools. However in actual condition the result may vary but at least you can have rough estimation.
- A 512MB cloud server from Digital Ocean on Ubuntu 15.10 x64
- Vestacp v0.9.8-15 with Nginx and PHP-fpm mode.
- WordPress v4.4.2
- WordPress theme is Schema by MyThemeShop.
- Dummy content also from MyThemeShop.
- No caching plugin in use.
Screenshot of the blog :
and the result :
GT Metrix Test
With 43 Requests needed to load the 1.36MB page size, it took 3.8s to load the site. The performance scores are B (82%) for PageSpeed ad B (88%) for YSlow. Pretty good isn’t it. However you can still tweak it more like installing caching plugin, using CDN, and so on.
According to Pingdom, the performance grade is 92/100 and it needs about 41 requests to load the page. It took 818ms (under 1 second) to load the blog main page sized 1.2MB. Pingdom said it is faster than 93% or all tested websites. Sounds good does it?
I set up the test to have 10 clients requesting the site every second. It means the simulation is like “there are 10 new visitor try to access the site every second“. It’s a client per second test. Read here for the differences. The result is as shown above. There is no invalid redirect, there is now 400 and 500 error (server error), the average response time is 3487ms (3.5s), fastest response time is 837ms ( <1s ) and slower response time is 5487ms (5.5s). I tried to rise the number of request to 15 req/sec but it started getting many errors.
For you who are wondering, 10 clients or visitors are requesting per seconds means 600 visitors per minute or it is roughly about 864k visitors per day. So if, for instance, your question is like “Can with this setting my 512MB DO cloud handle 50k unique visitors per day?” then the answer is most likely Yes (assumed there is no single second with more than 10 requests at the same time, otherwise it will crash). But however in actual environment the result may vary.
The test was using 50 unique visitors for 5 minutes test duration. The fastest load time around 300ms and the slowest load time was still below 1s. Even 50 UVs opening the site at the same time but the load time is still below 1s.
That’s it. I hope you have something in your mind already concluding the result of the performance test above.
I really wanna install php-fpm instead of apache but how does php-fpm handle .htaccess files?