Can we do multiple websites pointing one URL? - hosting

two different websites and i want one URL,
example: when user visit example.com from India he get website-1 but on same domain and same URL and he visit example.com from US than he get website-2 with same URL on same domain, so any one can help me ?

There are multiple ways to archieve this (including but not limited to):
DNS based approach
IP based approach
DNS based approach
You have two servers, one for website-1 and one for website-2. Now you configure your DNS server to serve the IP for website-1 if the client is from India and website-2 if the user is from the rest of the world. This feature is referenced as GeoDNS or "Geolocation Load Balancing".
I said "rest of the world" because you can never be sure, that there will be only requests coming only from India and the US.
IP based approach
Your server needs to decide after doing a GeoIP lookup of the client, which website to serve. Basically the same logic as above, but this time implemented on only one server. This can be done using most server side scripting languages and maybe even within your webserver itself.

Related

web site traffic load balancing issue

I am wondering how distributed web site traffic is balanced. For example, I have a web site which has the single domain name (www.foo.com) and supposing physically it is setup as three web servers in US, EU and Asia separately. When the end user is located in the US, I want the user to access US physical web server when he requests www.foo.com in his browser. When the end user is located in the EU, I want the user to access EU physical web server. And similar for Asia. The benefit is the end user could access the nearest server, which will give the best performance.
I believe most big and distributed web sites are implemented in this way, e.g Google. I am wondering how it is implemented internally? In more details, how the magic of finding the nearest server is implemented?
Here you go. A perfect article for you and me to understand how this works. Like #omar it's something to do with DNS.
Global DNS Load Balancing, direct the users based on their geography.
Quick Info:
A special DNS server, or a module attached with DNS server, return different answer to different request based on the request (generally another DNS server, which is your DNS server of your ISP) IP geo-location :
www.yourdomain.com ---[CNMAE Record] ---> geo.yourdomain.com --- [ GSLB handdling, CNAME ]--> us.geo.yourdomain.com -- [A record] --> 68.178.110.21
Please don't hesitate to have a look at this:
http://dev.robertmao.com/2007/06/30/global-dns-load-balancing-for-free/
Some of the players who give service:
Amazon Route 53, Cloudlevarage, f5, zeus, etc
Some of the ways you can build your own Geo-DNS:
Bind & MaxMind
Bind & MaxMind
This is done by using professional DNS services. They have world wide DNS servers who support DNS resolution from countries and return specific IP.

Directing dynamic subdomains to particular servers

We're building a multitenant SAAS app. Each customer gets its own subdomain, http://customername.mycompany.com. Each customer will have many gigabytes of data, which means that they have to be assigned to a particular server and stay there.
If I have a server farm, and a request comes in for a particular customer, how do I direct the request to the right server?
My thought is that I'll have to create some kind of custom, programmable load balancer that will know where each customer lives and proxy the request through.
Is there an easier way?
If not, where do I find such a load balancer? The ones I've found online act more like appliances than applications which could go query a database to find the right destination server.
I think the answer is in the question; you mention that the user will connect to username.mycompany.com. So use a DNS A record to point them to a particular IP.
In the future, if you wanted to load balance the user across (say 2) servers, you could create a virtual IP on a load balancer appliance (running LVS for example), and then point the A record to the Virtual IP created by the LB, and distribute the user across a group of servers that you have configured.
This is why using subdomains is simpler than having URL based access such as company.com/username, in which case you would have to inspect the content of the packet to see the requested URL. By using subdomains, everything can be done at the IP layer.

Ensuring folder name doesn't show up in the domain name

our hosting account is set up with the domain www.nashman.ca, and our application is at www.nashman.ca/hub. We have another domain that forwards to www.nashman.ca/hub and that's hub.mhn.co. The problem i'm having with this is that the forwarded domain adds on the /hub whenever you navigate to another page from hub.mhn.co, so the domain shows as hub.mhn.co/hub/admin when you're in the admin area, for example. I need the domain to stay consistent, and never show that folder name, because its breaking some of the javascript I use. What is the best way to set this up?
edit
I've been doing some reading about URL Rewriting, and looking into it - my hosting provider supports the IIS7 URL Rewrite module. All the tutorials I've found so far detail how to set up rules using the IIS config tools, but I don't have access to them. Is there a way to do it by editing my web.config in my apps root directory? And will this solve my issue?
Is the default page for hub.mhn.co using a redirect to www.nashman.ca? If so, what is happening is that the forwarding software basically returns a new URI that the browser requests, and the new URI will replace the old one in the browser window and thus in all future requests. You're probably redirecting to ~/hub/ (the hub subdirectory of the site root) which will result in the browser requesting a new URI that keeps the domain name but tacks on the subdirectory.
If you have direct control over the DNS and your webservers, you can use the DNS configuration to direct a request for the hub.mhn.co domain directly to the /hub subdirectory of your webserver. That way, the browser never knows that hub.mhn.co is actually www.nashman.ca/hub/. You might have to direct to an alternate port on the webserver and map that port to the subdirectory, depending on your DNS software (IIRC, most can deal with ipaddress/subdir routes, but some can only handle routing to ipaddress:port).
If your IT department does not have direct control/ownership over your DNS routing, or your exact hosting environment, you are more or less at the mercy of your hosting provider. They may be able to set up their environment to do the same thing, or not; all you can do is ask.
EDIT: Basically you have two options left if you're hosting remotely and can't use their DNS to reroute silently.
First option: clone (copy all files from) the web layer of nashman.ca/hub as hub.mhn.co under a different root space in your hosting environment (try to keep any hooks to service-layer code over at nashman so you don't have to copy the whole vertical slice). If you must also keep the UI under the /hub/ subdirectory, you're repeating code, but you may be able to mitigate this with deploy scripts that will allow you to deploy one local copy of your codebase to various locations. This may also cost more as your hosting environment is now hosting two non-trivial sites.
Second option: host the site and/or resolve the calls on your own hardware. As long as you have a public, static IP address through your ISP, you can provide a DNS server that will be the "authoritative" server for nashman.ca and hub.mhn.co domains. Your ISP or a third party domain name registry can provide a "pass-down" route to get requests from the TLD servers down to you. Then, you can route requests to whatever IP address, port and/or subfolder you like; that can be a remote webhosting provider (as long as they don't mind JUST hosting your site) or your own webservers. This will require the hardware, and a static IP from your ISP. If you lose power to this server, your site will be unreachable until power's restored. If the IP address of your DNS server changes, your site will be unaccessible by DNS until the server that routes requests to you updates its routing table with the new IP (which can be up to 24 hours).

How can I find the hosting company URL by domain name?

so I'm looking for a server host for a website that I'm building. Generally I know from continually visiting sites which ones I like and which I don't. I think this is a much better way than simply measuring ping times to determine speed.
So I want to know if there's a way to find out which hosting companies are hosting certain domains. Is this possible? whois.domaintools.com tells you certain information about the namesevers and the other about the DNS information about the host IP location. This is fine but I still don't get the website URL where I too can sign up for hosting. Often times the IP location name resolves to something really formal like XYZ Mallard Group Company LTD so this is basically useless to me. I need the hosting web URL instead.
Anyone got any ideas how I can find a domain's server hosting website url?
Thanks,
Marv
http://www.whois.net/ Will tell you the DNS (which a lot of time has the one you can sign up for, i.e. dns.dreamhost.com points you to dreamhost.com), and it also gives you more info about the registrar.
Finding hostnames of Ip's of server and DNS will help you to identify hosting provider

How to get personalized sub-domains for users and make them work?

Say I have a site hosted on example.com, now I want each of my registered user to get a personalized sub-domain, e.g Alice should normally gets alice.example.com as her sub-domain. While actually alice.example.com gets data from example.com/user/alice. How to implement this mechanism? I see lots of sites are working in this way. I wonder how they did it. Is it some kind of domain server configuration, web-server configuration, .htaccess rewrite or simply some tricks in the code?
If its redirecting, as I experimented, example.com and alice.example.com will get DIFFERENT IP addresses, if that, how rewrite works since when I request alice.example.com, the web browser takes me to a completely different site (IP address).
This has confused me for some time, I just can't figure it out myself, any help would be really appreciated.
[edit]: OK WAIT! I'm afraid I made a duplicate. Check this thread: Create subdomains on the fly with .htaccess (PHP)
Basically you need two parts:
1) Your Nameserver needs to support wildcards. So you would map *.mydomain.com to a single server. This will cause alice.mydomain.com and bob.mydomain.com to all go to the same server.
2) Then your server software should be able to map the hostname (=alice.mydomain.com) to your application and pass in the "alice" part as a parameter.
Depending in what framework/server software you use this should be quite easy.
HTH
Alex
Is it some kind of domain server configuration, web-server configuration, .htaccess rewrite or simply some tricks in the code?
It's probably a combination of the several techniques.
First layer would probably be a Wildcard DNS record on a DNS level so that any sub-domain can be used.
Next, server configuration or application logic is used to separate the content based on the accessed sub-domain. This can be Apache Alias directive or a Rewrite rule or logic in your application code.
I can tell how I did this on pastebin.com
wildcard DNS makes *.pastebin.com go to a single IP
By default, if Apache can't find a matching vhost for a given domain, the first defined vhost picks it up (there are other ways of achieving this, this is just what I did).
So I ensure the pastebin site is the first vhost, and so then software then sees the requested hostname and acts on it accordingly to configure itself

Resources