What I Choose, VPS or Shared Hosting. Based on My Experience

vps

A website needs hosting. At this time, there are 2 options, using shared hosting or VPS (even a dedicated server). Shared hosting is easier to use, less risk and its more complete. For beginners who want to have a website, which does not want to use a free service like wordpress and blogger, better use of shared hosting. Usually shared hosting using cPanel which is easy to use. Although simple, there are some people who can not use cpanel. If you include people like that, please use this tutorial.

Another alternative is to use the VPS. VPS mostly use Linux, although some use windows. Using the VPS is much more difficult and you have to know the basics of linux and the web server. Moreover, you should understand the basic security of a server. VPS is very similar to dedicated server.

I had a few months using VPS, and very satisfied with its performance. The website is much faster when accessible and easier to develop a website. You can save any number of sites you there, as long as your server is capable of handling.

vps

I chose Shared Hosting Because …

Shared hosting is much easier to use, and ready to use when you complete the payment. In shared hosting, security is usually already there. Party hosting providers usually have secured your hosting package, so that your site will be safe, unless you have a website script bugs that could be used by hackers to break into your hosting package.

Shared hosting that I recommend are

mediatemple host

  1. Bluehost
  2. Hostgator
  3. Mediatample (MT)
  4. ASO (asmallorange)
  5. Siteground

They have a good hosting package, powerful hardware and a nice pace. The price offered is around 3-9 dollars per month. I have experience with BlueHost and HostGator. Both are good hosting provider. But, in my HostGator been suspended for using too many resources, my site has a UV 7K per day. And apparently shared hosting package from HostGator are not able to handle it.

While Bluehost ability to handle more than 10 sites with visitor per site between 300-1000 UV per day. Quite good. But, to do a backup, at Bluehost is not as easy at HostGator. You can not create a backup file on the whole site, you must do it one by one.

You will hassles when your site grows larger and shared hosting no longer able to handle. Hosting provider may close access to your site, without telling you first. And this is not good for your site.

The solution: ask the hosting provider’s request to raise your level to a VPS hosting package. Maybe it takes no small cost, depending on the provider hostignya. Another solution is to regularly perform backups and when the provider hosting your website even close access your account, then you are ready to move to the VPS.

I choose VPS Because ..

VPS is much more difficult compared to shared hosting. You must know the command Unix / Linux, due to the interaction with the server using the command line, no longer uses cpanel. Although there are many control panel for VPS. There are free and paid.

Actually, the advantages of VPS is much more compared to shared hosting. You have more power to serve visitors to the site, and this will enhance the visitor experience.

Some of the advantages of VPS

  1. Free to determine the web server
  2. Access website to be faster
  3. Have direct access to the webserver systems
  4. More efficient if you have many sites
  5. Unlimted database domain + add on
  6. Have root access
  7. Backup easier
  8. Free to determine the scripts that run

etc. The bottom line is the freedom to grow. It is impossible for webdesignersdepot.com sites using shared hosting, definitely use the VPS or dedicated server, if use shared hosting, within 1 hour already on the blacklist.

However, VPS prone to hacker attacks. A few weeks ago, my server was down because of a hacker attack that strikes all the open ports of the VPS.

If you are using a VPS, you can choose some bash script to install and configure the VPS quickly and easily. You can choose VPSSIM or easyengine. VPSSIM only run on centos while easyengine for families debian including ubuntu.

Warning!!

Wherever you store your hosting, whether in shared hosting or VPS, always do the backup and the backup download to dropbox or a local hard drive. Because, you never know when your website is down. File your website is very important. If in the VPS, you can use a cronjob to perform backups or using this script

 

Great Resources to Secure Your VPS from Attacker + Bonus Video

how to secure vps

When deciding to use VPS rather than shared hosting, then you will get the key issues, namely security. Do not ever think that people out there are not going to attack your server. There are millions of script-kiddies who are ready to cripple your servers, regardless of the relationship with you, who are you or the person you are hostile.

VPS as you build a small house in the middle of a football field, at any time come rain, then your home will be affected. In contrast to shared hosting, where you build a house under a building. You will not be exposed to rain.

To that end, it is necessary security measures server. You can use the VPSSIM contained in it have a firewall or using easyengine, but you need to use iptables as firewall.

how to secure vps

This post will provide some tutorials to secure server (VPS) from attacks by hackers / crackers / script kiddies and other nuisance.

  1. Setting Iptables on Ubuntu 14.04 server ( i am use it)
  2. Basic configuration of Iptables on Centos
  3. Good story to secure your VPS
  4. Configure Right VPS Ubuntu
  5. Secure VPS with CSF

Video

 

Credit photo 

VPSSIM : Easy Way to Install Nginx, PHP-FPM and MariaDB on CentOS Server

using-vpssim-centos

For a beginner, of course, use the VPS is not as easy as using shared hosting, as VPS does require knowledge of Linux or UNIX computer. If you are accustomed to using Windows, try using linux. At first it will be difficult.

First time i am use VPS, which add a virtual host on a server nginx, I studied hard and finally can do it. But, if you like a more practical way without the need to know the basics of how to work the nginx web server, use vpssim. VPSSim is a bash script-based programs that make use linux more easily and automatically. Like using cpanel.

Unfortunately, VPSSim still running on Centos distro. If you use Debian or Ubuntu, you can use the easyengine. However, when using the easy engine, the script fails to install Percona DB, so its caused my VPS dont run perfectly. You must install Percona db manually or using MariaDB version 10.x I did not manage to install MariaDB version 5.6, somehow.

Ok, back to VPSSIM. This script will install Nginx, PHP-FPM and MySQL automatically. Its use is also very easy, forget the confuse linux codes.

Not only that, VPSSIM also facilitate you to manage many websites that exist on your server, add and remove never been this easy. You can also install wordpress, drupal, textpattern and others. Supports more than 19 CMS. Unfortunately not included framework = Cakephp, Laravel, CodeIgniter and others.

Before installing, you can try it, please follow the link below.

Install VPSSIM on CentOS Machine

yum -y install wget && wget https://vpssim.com/install && chmod +x install && ./install

 

6 Steps to Configure Virtual Host and CakePHP in Nginx Webserver

cakephp-on-nginx-solved

The use of shared hosting is limited designers and developers for creativity, time to move to a VPS or dedicated server. If you are a beginner, meaning that so far only use shared hosting, such as hostgator and bluehost, we recommend using the VPS. Technically, VPS is similar to a dedicated server, it’s just a different ability. If you want to learn, use the VPS.

I also am learning VPS. My goal is to use a web server Nginx + PHP FPM and MariaDB version 10. This is the system I wanted, because rarely shared hosting using Nginx web server. For the record, Nginx web server is a alternative web server for Apache and LiteSpeed  that have the ability to process requests faster and more memory efficient.

In this post I want to show you how to create a virtual web server hosting on Nginx. Maybe this is a personal record for me, so do not forget. You need to prepare is

  1. VPS hosting with OS Debian 6 or 7. I’m using version 7.
  2. Access as root
  3. And of course already installed Nginx, PHP FPM and MariaDB 10.x I will make this tutorial.

Ok, we started to just create a virtual host. In this experiment, I use a free domain from freenom. You can also get a free domain : cakephp.cf

1. Prepare Directory To Store Your Website Files

Sign in to SSH, and type this command

mkdir -p /srv/www/cakephp.cf/htdocs
mkdir -p /srv/www/cakephp.cf/logs

website files will be stored in the htdocs directory.

2. Creating Virtual Host in Nginx

cd /etc/nginx/sites-available/
touch cakephp.cf

3. Edit Your Virtual Host File

We use the nano editor to edit the configuration of the virtual host.

nano cakephp.cf

Then full fill of the configuration as below. For the case in this post, I want to use cakephp at this domain. Each virtual host configuration is different, depending on web technology you use.

server {
    listen   80;
    server_name www.cakephp.cf;
    rewrite ^(.*) http://cakephp.cf$1 permanent;
}

server {
    listen   80;
    server_name cakephp.cf;

 
	root /srv/www/cakephp.cf/htdocs/app/webroot/;
    index  index.php;

    access_log /srv/www/cakephp.cf/logs/access.log;
    error_log /srv/www/cakephp.cf/logs/error.log;

    # main cakephp rewrite rule
    location / {
        try_files $uri $uri/ /index.php?$uri&$args;
    }

        location ~ .php$ {
            root           /srv/www/cakephp.cf/htdocs/app/webroot/;
            try_files $uri =404;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 256 4k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
        }

}

If you want to use wordpress, please use the setting as below

server {
       listen 80;
       #listen [::]:80 ipv6only=on default_server;
       server_name cakephp.cf;
       root /srv/www/cakephp.cf/htdocs;
    access_log /srv/www/cakephp.cf/logs/access.log;
    error_log /srv/www/cakephp.cf/logs/error.log;
       if ($http_host != "www.cakephp.cf") {
                 rewrite ^ http://www.cakephp.cf$request_uri permanent;
       }
       index index.php index.html;
       location = /favicon.ico {
                log_not_found off;
                access_log off;
       }
       location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
       }
 
 # Use gzip compression
 # gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module
 gzip on;
 gzip_disable "msie6";
 gzip_vary on;
 gzip_proxied any;
 gzip_comp_level 5;
 gzip_buffers 16 8k;
 gzip_http_version 1.0;
 gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/png image/gif image/jpeg;
 
        location ~ ^/wp-content/cache/minify/[^/]+/(.*)$ {
                try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
        }
 
 #location ~ ^/wp-content/plugins/wp-minify/min/[^/]+/(.*)$ {
 # try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
 # wp-minify/cache
 #}
 
 # Don't cache uris containing the following segments
 if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php|wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
 set $cache_uri "no cache";
 }
 
 # Don't use the cache for logged in users or recent commenters
 if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp\-postpass|wordpress_logged_in") {
 set $cache_uri 'no cache';
 }
 
       
 
 # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
       location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
       }
       location / {
                try_files $uri $uri/ /index.php?$args;
       }
 
       # Add trailing slash to */wp-admin requests.
       rewrite /wp-admin$ $scheme:http://$host$uri/ permanent;
 
 # Cache static files for as long as possible - removed xml as an extension to avoid problems with Yoast WordPress SEO plugin which uses WP rewrite API.
 location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
 try_files $uri =404;
 expires max;
 access_log off;
 }
 
 # Pass PHP scripts on to PHP-FPM
 location ~* \.php$ {
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 try_files $uri /index.php;
 fastcgi_index index.php;
 fastcgi_pass unix:/var/run/php5-fpm.sock;
 #fastcgi_pass 127.0.0.1:9000;
 include fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 fastcgi_param SCRIPT_NAME $fastcgi_script_name;
   }
}

4. Download and Install CakePHP

cd /srv/www/cakephp.cf/htdocs
wget https://github.com/cakephp/cakephp/zipball/2.6.2
unzip 2.6.2
cp -rvf cakephp-cakephp-ec00c2d/* .
rm -R cakephp-cakephp-ec00c2d
rm 2.6.2

5. Creating Symbolic Link to Nginx

ln -s /etc/nginx/sites-available/cakephp.cf /etc/nginx/sites-enabled/cakephp.cf

Symbolic links useful for Nginx know new virtual host.

6. Provide Access Rights to the World

chown -R www-data:www-data /srv/www/cakephp.cf/htdocs

Now, look at cakephp.cf, runs perfectly.

Note: To follow this tutorial, you’ve directed your DNS to cakephp.cf domain. I use cloudflare for free and fast.

Dont forget to restart nginx with command like this.

service nginx restart

 

 

Tutorial : How to Running CakePHP on Easyengine VPS

CakePHP is my fav. framework, because of the ease and speed it offers, build web applications more quickly and easily, besides that, you are also more secure. The codes in CakePHP already in the test and get updated regularly. This is the advantage of making the web with the framework.

CakePHP using .htaccess to rewrite URLs in. Of course there must be a deal with the web server. Web servers that support the full CakePHP and easy to use is apache, because apache support .htaccess and mod_rewrite. Without these two elements, cakephp is not running perfectly.

Even so, cakephp give tips or special code that can run on all web servers. Including the nginx web server. I’ve run the cakephp on nginx, but it must make complex configuration.

But, with easyengine, you can run cakephp very easily and quickly. I was also surprised by this.

Easyengine is a python script created by rtcamp, a group of developers from India which allows us to install Nginx + PHP + MySQL and other easily and quickly. And everything is configured perfectly.

To install wordpress on easyengine, very easy and this article does not menjelasnnya. We will explains  how to install cakephp on easyengine.

Say you’ve installed easyengine and ready to action. I use ubuntu14.04 64bit with 3GB of RAM. Now you’re ready.

1. Create new site with  PHP+Mysql support

ee create site cakephp.cf --mysql

2. Download CakePHP latest version

wget https://github.com/cakephp/cakephp/archive/3.0.2.zip
unzip 3.0.2.zip
cp -rvf cakephp-3.0.2/* .

3. Update Permisssion

chmod -R 777 /var/www/cakephp.cf/htdocs/app/webroot/
chmod -R 777 /var/www/cakephp.cf/htdocs/app/tmp/

4. Update VHost file

nano /etc/nginx/sites-available/cakephp.cf

edit root line becoms like this below

root /var/www/cakephp.cf/htdocs/app/webroot/;

5. Restart your Nginx web server

And look at your domain. In this tutorial, I use cakephp.cf

This Script Will Simplify Running CakePHP on EasyEngine (Nginx)

cakephp on easy engine

cakephp on easy engine

A few months ago I wrote about Cakephp and nginx running on easyengine. Easyengine is a collection of scripts to facilitate the VPS users to install wordpress and other scripts on a web server nginx. Unfortunately for running Cakephp, it takes one line of the script so that all are running perfectly.

[code tipe=”336″]

Here are the steps to run CakePHP.

  1. Create site with mysql support (ee site create example.com –mysql)
  2. Upload your cakephp website. Or download it with wget command.
  3. Modify cakephp temporary and web root directory in order
    chmod -R 777 /var/www/yoursite.com/htdocs/app/webroot/
    chmod -R 777 /var/www/yoursite.com/htdocs/app/tmp/
  4. This is one line code that very crusial. Open website nginx config file with nano /etc/nginx/sites-available/yoursite.com
  5. Find and change
    root /var/www/yoursite.com/htdocs;
    to
    root /var/www/yoursite.com/htdocs/app/webroot/;
  6. Then restart your nginx server with command
    service nginx restart

Please check your site. This tutorial tested work on cakephp 2.x, I have not tried to version 3.x

[code tipe=”336″]

Please share this article, it will help many developer