ভিপিএস (VPS) কেনা, ব্যাসিক কনফিগারেশন, ল্যাম্প ইন্সটলেশন, ডোমেইন ম্যাপিং


VPS (Virtual Private Server) হচ্ছে একধরনের ভার্চুয়াল মেশিন বা ভার্চুয়াল কম্পিউটারও বলতে পারেন, যেটা একটা সার্ভিস হিসেবে কেনা যায় বিভিন্ন ক্লাউড সার্ভার প্রোভাইডারদের কাছ থেকে। এই ভার্চুয়াল মেশিন গুলোরও RAM আছে, হার্ডডিস্ক আছে, সিপিইউ আছে এবং সর্বোপরি একটা অপারেটিং সিস্টেম এর উপর চলে। মজার ব্যাপার হচ্ছে এরকম একটা মেশিনের বাস্তব কোন অস্তিত্ব নাই ঠিকই কিন্তু বাস্তব একটা ফিজিক্যাল মেশিনের মতই গঠন ও আচরণ। কিভাবে এই ভার্চুয়াল ইনফ্রাস্ট্রাকচার তৈরি ও মেইন্টেইনড হয় সেটা আজকে আমাদের আলোচনার মুল বিষয় নয়। বরং এরকম একটা ভার্চুয়াল সার্ভার মেশিনকে আমরা কিভাবে ওয়েব সার্ভার হিসেবে তৈরি করব সেখান থেকে কিভাবে ওয়েব কন্টেন্ট প্রোভাইড করবো সেটাই মুখ্য বিষয়।

কিনে ফেলি একটা ভার্চুয়াল প্রাইভেট সার্ভার

বিভিন্ন সার্ভার প্রোভাইডার তাদের মেশিনগুলোকে বিভিন্ন নামে ডাকে। যেমন অ্যামাজন এর ভাষায় এগুলো হচ্ছে ইন্সট্যান্স, Rackspace এর ভাষায় এগুলো ক্লাউড সার্ভার, DigitalOcean এর ভাষায় ড্রপলেট, ইত্যাদি। আমরা আজকের টিউটোরিয়ালের জন্য DigitalOcean এর কাছ থেকে একটি মিনিমাম কনফিগারেশনের সার্ভার কিনবো যেটাতে ৬৪ বিটের উবুন্টু ১৪.০৪ ইন্সটল করা থাকবে এবং আস্তে আস্তে এটা কফিগার করবো ওয়েব সার্ভার হিসেবে।
এই লিঙ্ক থেকে একটি সার্ভার কিনে ফেলতে পারেন (এটি আমার রেফারেল লিঙ্ক। এটা ব্যবহার করে সাইন আপ করলে $10 ক্রেডিট/ব্যালেন্স পাবেন, না করলে নাই) । প্রথমে অ্যাকাউন্ট ডিটেইল দিতে হবে এবং পরে ভ্যালিড পেমেন্ট মেথড অ্যাড করতে হবে। যদিও এরা এক মাস শেষ হলে পেমেন্ট মেথড থেকে বিল চার্জ করবে তার আগে না। আপনি চাইলে সার্ভার মাঝে মাঝে শাটডাউন করে রাখতে পারেন। সেই সময় গুলোতে বিল কাউন্ট হবে না।
Continue reading ভিপিএস (VPS) কেনা, ব্যাসিক কনফিগারেশন, ল্যাম্প ইন্সটলেশন, ডোমেইন ম্যাপিং

Installing Laravel4 in Mac OSX with MAMP

In the past and first tutorial of this series we learned how to create a virtual host with MAMP. In this second tutorial, we will install laravel4 PHP framework and will go another step toward developing a full laravel4 application series.


  • Make sure your installed PHP version is greater or equal to 5.3.7
  • Also make sure the MCrypt PHP extension is enabled
  • For pretty URL the mod_rewrite module is enabled on Apache

1. Install Composer Globally:

The following command will just check a few PHP settings and then download composer.phar

You can run these commands to easily access composer from anywhere on your system

2. Create a laravel project named “thisdayinbangladesh” inside our MAMP’s “htdocs” directory:

Going inside the “htdocs” directory

Creating the project there

3. A small permission issue:

Lets enter into our project directory

Change the permission of the storage folder to writable

4. Basic Configuration:

Update line number 29 of the “app/config/app.php” file to

and line 42 to

5. Database configuration:
Though configuring database is not necessary to have a first run but lets complete this step as we will not do any editing on the config files later.

6. Lets have a test run:

Open the URL of your laravel application as we created earlier using virtual host; on the browser. That is http://thisdayinbangladesh.dev/
You should arrive!

Get Google News as JSON by Parsing rss feed

As you know already that, Google News search API has been deprecated few years ago. Still developers need to have Google news as an usable format like JSON for different purpose & development platforms.

Google still provides the news service but in rss format. So, we can have those data for using just by parsing and reformatting them. I wrote a very small php class which will first search  news on Google by specific keywords and load the XML. Then it will parse the XML carefully to dissect parts of news & finally will provide a formatted JSON data set.

As of JSON, all knows that how universal this data format is to implement on several software development platforms. Hope this tiny class help some one 🙂

The class file:

Example usage:


You will find this source code on github also. Feel free to use and or fork.

Setup a custom domain for your appfog application

On a previous post we saw how to deploy a PHP application in appfog using appfog CLI. appfog gives you a domain for your newly created aaplication which is not so beautiful at all. Such as (http://YOUR-APP-NAME.aws.af.cm/) or something like that according to your choosen region/infrastructure while creating the app.

Today we will point a godaddy domain to a appfog application. For this you will have to first go to your app under your appfog account. Then select the Domain Names from left navigation. Here you can see the domain name already assigned to your application and few more blank fields for domain names to be added.

Also you can see the DNS instructions for custom domains” below that form. Here it will show what “A” record and CNAME record you should add on your own domain control panel.

Screen Shot 2013-02-14 at 7.24.46 PM

I have added www.nuhil.net as the second domain name. Then I added a “A” record and a “CNAME” record under my godaddy domain management panel using the DNS manager.

godaddyIf you wait few hours after changing the records in your domain end, then this will point the full domain for example http://www.nuhil.net to the appfog application but if you type the naked one like, http://nuhil.net then it will show a 404 not found appfog message. For the solution I did a forwarding under my godaddy account using the “forwarding domain tool” to forward the naked domain to full domain.

Screen Shot 2013-02-14 at 7.39.38 PM

This forwarding may cause a change on your “A” record you just created manually according to appfog’s suggestion. But no need to worry. The “CNAME” can take care of all the rest.

Deploy Application in Amazon Beanstalk inside free EC2 Instance with RDS

Amazon has virtual cloud server (instance) and many other web services. They offers a 1 year free micro tier to be used by anyone who own an international currency Debit/Credit card like Payoneer debit master card. There are several services included with the free tier that can be used along with the EC2 instance without any extra charge. Beanstalk deployment framework is one of the free services you are eligible for.

For no additional charge, AWS Elastic Beanstalk allows you quickly and easily deploy your Java, PHP, Python, Ruby, and .NET applications using many of the services offered in the free usage tier.” -Amazon. Beanstalk is similar to other deployment frameworks like appfog, pagodabox etc. Moreover if you use Beanstalk then you will still have access to your virtual cloud server in which the deployment will be running. “Behind the scenes, Elastic Beanstalk handles the provisioning of a load balancer and Amazon EC2 resources.” -Amazon. Thats why I prefere Beanstalk than others who are in my knowledge.

In this post we will cover the steps of creating an account for Amazon EC2 free tier, configuring local machine for Amazon CLI tools, creating a sample app locally, creating an elastic beanstalk php environment, deploying a sample php app, creating an Amazon RDS and connecting to it via PHP and mySQL workbench, git version controlling of the deployed app, setting up a custom classified domain to our newly deployed app environment. Tired to read these ? I am sure you will feel best after having this journey 🙂

1. Create an account for Amazon web service from here . You can see the service list that will be included with your free tier for your further using. Note that, the sign up process is simple and you will be asked to provide your card detail on the second step and finally you will have to verify your phone number. You will have to put your phone number then to click “call now” button then a 4 digit pin number will be appeared on your browser. After that an automated call will reach your phone. You should either speak the pin number slowly or input the pin number in your mobile keypad if it supports touchtone functionality. I always spoke the pin after listening the bot girl’s voice 🙂 Continue reading Deploy Application in Amazon Beanstalk inside free EC2 Instance with RDS

Deploy apps on pagodabox with git version controlling

In the very last two posts we saw how to deploy apps in appfog. Today we will see how to deploy such apps in pagodabox. pagodabox is another deployment platform/framework like appfog. I found something good feature here such as you can have a free SSL certificate for your instance under the free scheme and you can see all your git commits under you app’s dashboard and simply deploy any version from your commit history just by clicking a button. Their punch line is “An Object Oriented Hosting Framework”

To start deploying your app on the cloud, just sign up in pagodabox obviously without any requirement of valid payment method as like appfog 🙂

Step A: You need to install the pagodabox command line tool just like you did for appfog according to the last post. For this, type the following command on Mac terminal:

Ruby and RubyGems come pre-installed on Mac OSX. As long as you are running v10.6 or later. For windows or any other issue you can check here. Also you should add an SSH key of your local machine to your pagodabox account. Just follow this simple process. Continue reading Deploy apps on pagodabox with git version controlling

How to host/deploy a PHP app from local machine to appfog

On the previous post we deployed a wordpress site along with a mySQL service by appfog’s built-in installation process in a very fast way. In this post we will describe the process of deploying again a wordpress site but from our local machine like as our own custom PHP app.

Step A: Sign up in appfog and it will show no app under your account. Just leave the browser. Nothing to to do there now. We will use appfog command line tool to both create and upload the files to appfog.
For that, enter the following command in your Mac OSX terminal

After successful installation of “af” you can write the following command and provide your appfog account detail to login to the service.

Note: “af” requires Ruby 1.8.7 or newer. You should Ruby installed already in your Mac 10.6+ . If any problem occurs or you are using Windows then follow this link to resolve. Continue reading How to host/deploy a PHP app from local machine to appfog

How to host/deploy wordpress on appfog within 2 minutes

AppFog delivers a reliable, scalable and fast platform for deploying applications in the cloud. Unlike installing OS, configuring, managing and monitoring a VPS (Virtual Private Server) like Amazon EC2 or Rackspace Cloud Servers, this kind of deployment/hosting platform/framework is much better for developers to use. As their punch line says “Simple, elegant, and modern way to develop and deploy apps.”

Here in the post we will describe how to host/deploy a wordpress site in a very fast way cause appfog has wordpress under quick installation option. Following this option will install both PHP with WordPress app along with a mySQL service under your account.

Step A: Sign up here without any hassle of providing a valid payment method 🙂

Step B: Click on “New App” button

Continue reading How to host/deploy wordpress on appfog within 2 minutes

How to get formatted address by Google Maps API

This is an example procedural steps for getting level wised (City, State/Division, Country, Latitude, Longitude) geolocation from a given address string.

This example can be implemented on a input form where user will put his physical address and your system will store the additional information for further use like for generating location based query corresponding to that address. For example your system can suggest him near by places using his latitude, longitude by calling another google maps API.

The output should be:

Rotating Image to any degree with transparent background

The following code will rotate an image to any given degree and if you use png image then the background color can be transparent. So, you can use that rotated image upon any image or color.