Tag

localhost 12.34.56.78 jupiter.example.com

Perfect Server in 5 minutes – Virtualmin + Nginx + ProfitBricks

By | Featured, Sample Work | No Comments

In this quick tutorial, I will show you how to setup a perfect VPS system with infinitely expandable storage and capacity from the new hosting provider ProfitBricks.

Background: VPS speed is somewhat of a commodity these days, and is not only increasingly hard to come by – but hard to customize. I was in search of a new VPS host that would allow me to customize all three dimensions of a host – memory, cpu, and storage. Amazon has created an incredibly complex system for what should be a stupid simple task. Most providers, Linode included do not allow you to scale resources independently, but rather makes you choose – fast, good, and cheap. Luckily – ProfitBricks is here to solve the problem. I can create as many disks as I would like, as many servers and CPU’s, and choose exactly how much RAM. Now add in the fact that ProfitBricks performance is currently topping EngineYard, Amazon, and Linode — it’s time to give it a try!

Compounding the problem my cPanel license is up for renewal, and I am rather dissatisfied with the experience. The admin panel feels old and clunky with too many configuration options for very little gain. I spent multiple times recompiling Apache tinkering with php options rather than focusing on the work at hand. Control Panels should make life easier, not harder. Virtualmin was always on my short list and I have tried earlier versions – however the lack of Nginx support was the Achilles heel for me. As of today, they have solved this problem and Virtualmin natively support Nginx! Bravo.

Once Virtualmin is installed you can use the GUI to create, format, and mount additional storage drives created in the ProfitBricks data center designer interface. This makes handling all this new capacity, like multi-terabyte additional storage a breeze to handle.

To begin, create and account with ProfitBricks and use the Datacenter Designer to create an internet connection, server, and storage. The free demo brick will do just fine. Once you have logged in as root begin the routine:

1. Set your hostname
[raw]echo “jupiter” >; /etc/hostname
hostname -F /etc/hostname[/raw]

2. Update host file
[raw]127.0.0.1 localhost.localdomain localhost
12.34.56.78 jupiter.example.com jupiter[/raw]

3. Set timezone
[raw]dpkg-reconfigure tzdata[/raw]

4. (Optional) Add Additional Repo’s : DotDeb will keep you using the most up-to-date LEMP stack
[raw]echo ‘deb http://packages.dotdeb.org stable all’ >;>; /etc/apt/sources.list.d/DotDeb.list
echo ‘deb-src http://packages.dotdeb.org stable all’ >;>; /etc/apt/sources.list.d/DotDeb.list
wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | sudo apt-key add –
rm dotdeb.gpg[/raw]

5. Update and Upgrade
[raw]apt-get update
apt-get dist-upgrade[/raw]

4. Reboot
[raw]reboot[/raw]

5. Download Virtualmin
[raw]wget http://software.virtualmin.com/gpl/scripts/install.sh[/raw]

Make the script executable:
[raw]chmod u+x install.sh[/raw]

Run the install script:
[raw]/bin/sh install.sh[/raw]

When it’s finished, all you need to do is open a browser and go to port 10000 on the server:

https://yourdomain.com:10000

Walk through the install process, configuring options as required. Remember to turn off BIND in System Settings – >; Features and Plugins

Time to install NGINX:

Shutdown and disable Apache
[raw]/etc/init.d/apache2 stop ; update-rc.d apache2 remove[/raw] Install Nginx:
[raw]apt-get install nginx[/raw] Start Nginx:
[raw]/etc/init.d/nginx start[/raw] Install Virtualmin Nginx Plugin:
[raw]apt-get install webmin-virtualmin-nginx webmin-virtualmin-nginx-ssl[/raw]

Before you continue, fix the broken SSL implementation:

Fix Broken SSL Argument:

[raw]nano /usr/share/webmin/virtualmin-nginx-ssl/virtual_feature.pl[/raw]

Change line 152 to >> [raw]&virtual_server::find_matching_certificate($d);[/raw]

Now-

Login to virtualmin as root (https://ipaddress:10000)

1.  Go to System Settings ->; Features and Plugins
2.  Un-check the “Apache website” , “SSL website” and “DAV Login”, “Mailman”, “Protected web directories”, “AWstats reporting” and “Subversion repositories” features.
Check the “Nginx website”, then click “Save”.

Due to a small bug you cannot select “Nginx Website” and “Nginx SSL Website” at the same time. So go back and select “Nginx SSL Website” after enabling “Nginx Website”.

Go to the System Information page and click Refresh system information in the top right.

Verify that running appears next to Nginx in the Status section.

It’s also a good idea to click on System Settings ->; Re-Check Configuration after everything is done to ensure it’s work properly

Now you can add Nginx sites using the Create Virtual Server link as you would with Apache. The only thing different is “Enable Nginx” needs to be checked in the features section.

BONUS FEATURE:

Here are some of the best utilities for your server!

Don’t forget to install these great addons!

[raw]apt-get install bmon htop aria2[/raw]

bmon – monitor your bandwidth on each adapter

htop – enhanced Top

aria2c – download magnet files or multi-threaded gets