Showing posts with label Amazon Web Services. Show all posts
Showing posts with label Amazon Web Services. Show all posts

Create Dynamic Subdomains using PHP and Htaccess

Dynamic subdomains like Google Blogger and Tumblr.com, I know most of the people are looking for better solution. Today I want to explain how to achieve this using .htaccess with PHP. I especially love to write .htaccess file, using this you can easily host multiple domains in single server. This dynamic subdomain system is the base for cloud services, soon I will come with new tutorial. I hope this post will solve your problem, please take a look this live demo.
  Step 1
Go to your domain DNS(Domain Name Settings), click add zone record.
 Step 2
You need to create a custom A record to serve all your subdomains. Select A record, HOST * POINTS TO: Your ID Address(Eg: 106.21.252.71)

Step 3
Repeat the same for HOST @, here is the listed A records.
Step 4
Now add CNAME record, HOST www POINTS TO @ this refers to your IP address.
Step 5
CNAME list should be in following way.
Step 6
Save all of your domain DNS settings.

Working with Hosting Server
We can achieve dynamic subdomains system with .htaccess URL redirection configuration file, here I have a project directory called yourwesbite_folder
(1) Root .htaccess
This file is redirection http://www.yourwesbite.com to http://yourwebsite.com for home page use. All of the subdomain redirection to yourwebsite_folder
RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.yourwebsite.com
RewriteRule (.*) http://yourwebsite.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^yourwebsite\.com $
RewriteCond %{REQUEST_URI} !^/yourwebsite_folder/
RewriteRule (.*) /yourwebsite_folder/$1

RewriteCond %{HTTP_HOST} ^(^.*)\.yourwebsite.com
RewriteCond %{REQUEST_URI} !^/yourwebsite_folder/
RewriteRule (.*) /yourwebsite_folder/$1

(2) Inside Folder .htaccess
This file is rewriting the subdomain urls.

http://yourwesbite.com/index.php?siteName=9lessons
to
http://9lessons.yourwebsite.com
Options +FollowSymLinks
RewriteEngine On

RewriteBase /

RewriteRule ^([aA-zZ])$ index.php?siteName=$1
RewriteCond %{HTTP_HOST} ^(^.*)\.yourwebsite.com
RewriteRule (.*) index.php?siteName=%1

More .htaccess tips: Htaccess File Tutorial and Tips.

index.php
This file contains simple PHP code, using regular expressions validating the subdomain value.
<?php
$siteName='';
if($_GET['siteName'] )
{
$sitePostName=$_GET['siteName'];
$siteNameCheck = preg_match('~^[A-Za-z0-9_]{3,20}$~i', $sitePostName);
   if($siteNameCheck)
   {
     //Do something. Eg: Connect database and validate the siteName.
   }
   else
  {
    header("Location: http://yourwebsite.com/404.php");
   }
}
?>
//HTML Code
<!DOCTYPE html>
<html>
<head>
<title>Project Title</title>
</head>
<body>
<?php if($siteNameCheck) { ?>
//Home Page
<?php } else { ?>
//Redirect to Subdomain Page.
<?php } ?>
</body>
</html>

No Subdomain Folder
If you are using root directory(htdocs/public_html) as a project directory, use this following .htaccess file.
Options +FollowSymLinks
RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} ^www.yourwebsite.com
RewriteRule (.*) http://yourwebsite.com/$1 [R=301,L]

RewriteRule ^([aA-zZ])$ index.php?siteName=$1
RewriteCond %{HTTP_HOST} ^(^.*)\.yourwebsite.com
RewriteRule (.*) index.php?siteName=%1

Credit to 9lessons

DigitalOcean becomes the second largest hosting company in the world

DigitalOcean has grown to become the second-largest hosting company in the world in terms of web-facing computers, and shows no signs of slowing down.

The virtual private server provider has shown phenomenal growth over the past two-and-a-half years. First seen in our December 2012 survey, DigitalOcean today hosts more than 163,000 web-facing computers, according to Netcraft's May 2015 Hosting Provider Server Count. This gives it a small lead over French company OVH, which has been pushed down into third place.

DigitalOcean's only remaining challenge will be to usurp Amazon Web Services, which has been the largest hosting company since September 2012. However, it could be quite some time until we see DigitalOcean threatening to gain this ultimate victory: Although DigitalOcean started growing at a faster rate than Amazon towards the end of 2013, Amazon still has more than twice as many web-facing computers than DigitalOcean today.

Nonetheless, DigitalOcean seems committed to growing as fast as it can. Since October 2014, when we reported that DigitalOcean had become the fourth largest hosting company, DigitalOcean has introduced several new features to attract developers to its platform. Its metadata service enables Droplets (virtual private servers) to query information about themselves and bootstrap new servers, and a new DigitalOcean DNS service brought more scalability and reliability to creating and resolving DNS entries, allowing near-instantaneous propagation of domain names.

Other companies are also helping to fuel growth at DigitalOcean. Mesosphere created an automated provisioning tool which lets customers use DigitalOcean's resources to create self-healing environments that offer fault tolerance and scalability with minimal configuration. Mesosphere's API makes it possible to manage thousands of Droplets as if they were a single computer, and with DigitalOcean's low pricing models and SSD-only storage, it's understandable how this arrangement can appeal to particularly power-hungry developers.

In January, DigitalOcean introduced its first non-Linux operating system, FreeBSD. Although less commonly used these days, FreeBSD has garnered a reputation for reliability and it was not unusual to see web-facing FreeBSD servers with literally years of uptime in the past. In April, DigitalOcean launched the second version of its API, which lets developers programmatically control their Droplets and resources within the DigitalOcean cloud by sending simple HTTP requests.

More recently, DigitalOcean introduced a new European hosting region in Frankfurt, Germany. This is placed on the German Commercial Internet Exchange (DE-CIX), which is the largest internet exchange point worldwide by peak traffic, allowing Droplets hosted in this region to offer good connectivity to neighbouring countries. (An earlier announcement of an underwater Atlantis datacenter sadly turned out to be an April Fool's joke, despite the obvious benefits of free cooling).

Even so, Amazon still clearly dwarfs DigitalOcean in terms of variety of features and value-added services. Notably, Amazon offers a larger variety of operating systems on its EC2 cloud instances (including Microsoft Windows), and its global infrastructure is spread much wider. For example, EC2 instances can be hosted in America, Ireland, Germany, Singapore, Japan, Australia, Brazil, China or even within an isolated GloudGov US region, which allows US government agencies to move sensitive workloads into the cloud whilst fulfilling specific regulatory and compliance requirements. As well as these EC2 regions, Amazon also offers additional AWS Edge Locations to be used by its CloudFront content delivery network and its Route 53 DNS service.

Yet, as well as its low pricing, part of the appeal of using DigitalOcean could lie within its relative simplicity compared with Amazon's bewilderingly vast array of AWS services (AppStream, CloudFormation, ElastiCache, Glacier, Kinesis, Cognito, Simple Workflow Service, SimpleDB, SQS and Data Pipeline to name but a few). Signing up and provisioning a new Droplet on DigitalOcean is remarkably quick and easy, and likely fulfils the needs of many users. DigitalOcean's consistent and strong growth serves as testament to this, and will make the next year very interesting for the two at the top.

Credit to - Paul Mutton

Why growing cloud DigitalOcean isn’t scared of Amazon, Google, and Microsoft

NEW YORK — Fast-growing cloud provider DigitalOcean might not have hundreds of thousands of servers  the way Amazon, Google, and Microsoft do to run its high-profile public clouds. But no matter. Ben Uretsky, the company’s chief executive, believes his startup has quite a few things going for it.

Perhaps most importantly, according to Uretsky, the company refuses to deprioritize user experience  unlike the cloud giants that he sees as competitors.

“These providers focus on the technical features, and what we focus on is this is why were highly differentiated is we’re focused on people, and in this specific case, we’re focused on developers,” Uretsky said in an interview with VentureBeat at DigitalOcean headquarters here last week. “We are a product-driven company, whereas these other businesses are more technically driven, I guess.”

Whatever DigitalOcean is doing, people seem to like it. Netcraft now considers it the third-largest web-hosting company, and developers regularly name-drop DigitalOcean as an option for hosting sites, often citing the fast solid-state drives backing up the startup’s server slices, or droplets, in company parlance, and the prices, which start at $5 per month.

Sure, it lacks some of the popular services available from larger cloud providers, like an object-storage service and server load balancing. And it hardly brings in the revenue that, say, Amazon Web Services does. Nevertheless, the company does have developer cred. And one day, the developers who prefer DigitalOcean for side projects may want to choose it for a new application at work. Which is why DigitalOcean must be paid attention to.

Plus, feature announcements are on the way.

This year, following a $37.2 million funding round, the startup has worked to expand its global data center footprint and start hiring more people. The startup now has 110 employees.

“If 2013 was about growing the physical infrastructure, 2014 has been about growing the organizational structure and the people,” Uretsky said. “We’re in the best shape that we’ve been in in terms of team size, process, and things of that sort, so hopefully 2015 is finally a year where we can really make progress on our mission, which is to bring additional products and features to market that customers are asking for, while maintaining a simple, easy-to-use product, which is also really challenging.”

DigitalOcean has been looking to upgrade its networking hardware and centralize management across switches, and eventually roll out networking capabilities for customers, Uretsky said. DigitalOcean also plans to get compliance certificates to meet certain kinds of IT standards. Graphs for RAM and disk usage should be coming down the pipe soon, too.

But even as the startup adds features and keeps prices low “I don’t think anyone really focuses on price,” Uretsky said the directive is to ensure DigitalOcean remains user-friendly.

“We need to provide simple, powerful solutions, and that’s a complex problem,” Uretsky said. “It’s almost like a noble pursuit. It is so challenging to walk that fine line between being able to deliver something easy and yet retain its nature.”

DigitalOcean raised $83M and you don’t even know what it is. Allow me to explain

There is a very interesting company in New York called DigitalOcean. Today it announced that it has raised $83 million in new funding.

You might have heard of the company developers you know have probably mentioned it in passing but you might not know what it actually does. If that is the case, do not fear. I will explain everything.

DigitalOcean maintains and provides cloud infrastructure that applications to run on. Instead of making available a long and dizzying list of instance types and storage services for developers to choose from and tie together like top cloud providers Amazon Web Services, Google Compute Engine, and Microsoft Azure DigitalOcean offers convenient “droplets” of compute and storage power for rent by the hour.

More than 6 million of these droplets have been deployed, atop tens of thousands of servers, by more than 500,000 developers, the startup says.

About 100 of the Fortune 500 have tried out DigitalOcean, the startup discovered through a recent survey. Customers include Compose, Flywheel, Ghost, InfluxDB, Pertino, and TaskRabbit.

Two months ago, DigitalOcean became the second largest hosting company in the world (second only to Amazon), at least by one metric. Last year, thanks to $50 million debt facility, the company was able to go from merely leasing servers to buying them outright. It’s growing up, in other words.

But Ben Uretsky, chief executive and a cofounder of DigitalOcean, doesn’t want to give up sacrifice the company’s simplicity in his quest to make DigitalOcean a part of many companies’ IT architectures.

“Do we really need 31 flavors of ice cream?” Uretsky asked me in an interview.

To be fair, Uretsky knows the company is missing some important features, namely an object storage service that’s comparable to the widely used Simple Storage Service, or S3, from Amazon. Uretsky wants to add advanced networking features, too.

Just because DigitalOcean’s portfolio is limited doesn’t mean companies are eventually migrating to other clouds, or their own data centers, as they mature. “That’s not what’s happening,” Uretsky told me. “Our customers don’t leave us. They don’t outgrow us. Our churn rate is the same as industry average. Infrastructure is inherently sticky. Switching costs are still very high.”

DigitalOcean is definitely not bringing in as much money as Amazon Web Services — the market leader is now doing more than $5 billion in revenue annually. And DigitalOcean operates considerably less infrastructure than Amazon Web Services, which may well be running more than 1.4 million servers at this point. But. But! If there is one cloud infrastructure startup to watch, it is, without question, DigitalOcean.

“There is no competition,” he told me. “We don’t think about the competition.”

That means no battling in the cloud price wars, no feature matching (DigitalOcean has not rushed to come out with a Docker container management service, for example), and no mad rush to set up a data center in every country. All DigitalOcean has to do is just keep it simple.

Access Industries led the new round in New York-based DigitalOcean, with existing investor Andreessen Horowitz also participating. The startup employs 150 people, and Uretsky wants to double that number.

Credit to - venturebeat