Need Help shifting my Magento Ecommerce site on VPS.

February 14, 2017 1.2k views
Apache Control Panels Development Security CMS PHP Frameworks DigitalOcean Ubuntu 16.04

Hello Everyone,

I'm new here on Digital Ocean. Due to very good reviews & amazing service provided(along with hassle-free letsEncrypt ssl cert) by Digital Ocean I've decided to shift my website from Hostgator's shared hosting to Digital Ocean's VPS.
I'd like to clearify that this is my very first time setting a server by myself on a VPS as I'm more of a Front-End guy & mostly just work on UI. I am following up the tutorials provided by the DO community(Which are btw very well explained & easy to follow..Ty DO for that!)
I've opted for $5 plan(as there's not much traffic right now)

So, right now I have a magento based Ecommerce site which was getting hosted on Hostgator. I had a Cpanel there which made things easy. I've got the whole backup of the site with me.
I so far understand that I'll have to first install LAMP stack which I have done already, and next I'm gonna setup VestaCP which I recently heard about that'll provide me Control panel with built in manager for website, email, database & DNS functionalities. Also, it'll allow to achieve high performance by utilizing the resources in better way.

Now my major concern is Two things- Performance & Security.
Please tell me if what I've planned is alright? & what else I should to ensure better performance & security or if not then what would be the best approach for me here?? Also, I don't know what all files from backup i need to upload & where exactly.

Also, currently I'm dedicating a whole droplet individually for this website, maybe in future I would host one more site..Will it be alright??

I would appreciate any inputs you people could provide.

Thank you very much in advance :)

1 Answer
jtittle1 February 14, 2017
Accepted Answer

@praveenkaushik

First off, welcome to the DigitalOcean Community :-).

Shared .vs. VPS

DigitalOcean provides un-managed Cloud VPS's, which differ quite a bit from Shared Hosting in that you will be responsible for managing the VPS, installing the LAMP or LEMP Stack, tweaking/tuning, updating and upgrading software, handling security, etc.

Since you're provided with a barebones VPS, there's not a control panel installed by default, though you do have the option of installing one. You can install cPanel (which carries a monthly fee) or a free alternative, such as VestaCP (which works pretty well, from my experience with it).

Performance

Since you're wanting to run Magento, I would recommend at least a 1-2GB Droplet (2GB would be my personal recommendation) instead of a 512MB.

The reason for this is because unlike shared hosting, you need to factor in RAM that will be used by the services you're running (i.e. Apache/NGINX, PHP/PHP-FPM, MySQL/MariaDB, etc), not just the applications you're running.

The above would be just as true if you were running WordPress + WooCommerce. You simply need more resources to run heavier applications, otherwise you risk running in to OOM (out of memory) errors, which will ultimately lead to services crashing/failing.

As for performance overall, while stock software installations will perform decently well, in most cases, ultimately how well the software performs will depend on how you tweak/tune it's configuration.

Performance tuning is much like security, it's ongoing :-).

...

Security

When it comes to security, the basics apply to all situations, i.e.

  • Use SSH Keys instead of passwords for SSH Access;
  • Create a sudo user, disable root logins, use unprivileged users for serving content;
  • Use a firewall and setup a basic configuration, then modify it to suite your needs;
  • Use chmod 755 for Directories and chmod 644 for files;

...

DigitalOcean Guides

...

DigitalOcean Tutorials

The link below will provide you with a search box where you can input anything, such as:

  • Ubuntu 16.04
  • Apache
  • NGINX
  • MySQL
  • etc...

... and it'll return results for your query.

https://www.digitalocean.com/community/tutorials

When you start a new server, there are a few steps that you should take every time to add some basic security and give you a solid foundation. In this guide, we'll walk you through the basic steps necessary to hit the ground running with Ubuntu 16.04.
  • Hi,

    Firstly, Thank you very much for answering my query. I really appreciate it very much :-)

    I will follow your advice & would also take in the recommendation to upgrade my droplet plan to 1GB RAM.

    Secondly, I want to ask that I'm installing VestaCP initially.
    I understand that this installation script installs the control panel and all its dependencies to the server. This includes:
    Nginx Web Server
    Apache Web Server (as backend)
    Bind DNS Server
    Exim mail server
    Dovecot POP3/IMAP Server
    MySQL Database Server
    Vsftpd FTP Server
    Iptables Firewall + Fail2Ban
    Roundcube mail client

    So, shall I configure them separately or let the default configurations installed through Vesta as it is? If yes, then what extra tweaking do i need to do in order to ensure the enhancement of the system?

    And also could you tell me about the files I will need to upload from the backup & if changes needed to setup them for the environment.

    I would appreciate any input. Thank you again sir :)

    • @praveenkaushik

      If you choose to install VestCP, it will install the stack for you. You would then login with the credentials provided to you from the CLI once the installer completes and proceed to add your domain(s) from the control panel.

      As far as tweaking and tuning the configuration, it depends on how well your website works with the out of the box configuration. I always recommend starting with the default and then if things seem slow or sluggish, then you start with each service, one by one.

      To migrate your site from your current provider, HostGator, to your Droplet, you'd need to create a backup of all files in ./public_html as well as your databases using phpMyAdmin from within cPanel.

      Unless HostGator has changed since I worked on an account with them about a year ago, all your files should be in ./public_html (i.e. all files associated with Magento), so that should be all for files.

      You would then upload those files to your new Droplet, restore the databases, switch your DNS on your domain and troubleshoot if you run in to any issues along the way. In most cases, it should be a pretty simple transfer since we're not looking at anything too complex.

Have another answer? Share your knowledge.