setup low Latency web server from two location - linux

how to setup two web server one from Asia and one from USA so that whenever request comes in it's should go to nearest server?

You are describing building your own CDN and it's not a simple task that can be answered in one paragraph. This document describes one way to do it using bind and GeoIP (and some other tools.) http://blog.unixy.net/2010/07/how-to-build-your-own-cdn-using-bind-geoip-nginx-and-varnish/

I think you should get the client's geographical location based on its IP (this tool could help), then use a tool like this to determine the distances from its location to yours (Asia and USA) and finally redirect the client to the nearest one.
The last step is backend-dependent, i.e Apache, Nginx, Node.js, etc.
I think Apache has some mods (mod_geoip, mod_geoip2).
And here are some Node.js modules (geoipcity, node-geoip).
I hope it helps you.
Sorry but I cannot publish more than 2 links because of my reputation :/

If you had the IP of the geographical location using the tool stated by Sam, you could use an Amazon EC2 and there cloud services to host a web instance with static IP endpoints tied to your servers. Then you could test whatever you want.
Hope this helps!

Related

How to block users accessing site outside of UK?

Searched the web and unable to find a solution. I have an umbraco site using IIS to host on a Windows server. Any ideas on approach to block users accessing site outside the UK? Htaccess approach would be too slow.... thank you in advance!
That's quite hard to do accurately, as you could have someone based in the UK using a European network provider, which means that they might appear to come from say Holland instead of the UK. It's also possible for people to spoof their location fairly easily if they really want to get at your site.
As Lex Li mentions there are plenty of commercial databases and tools for looking up a user's location, but the accuracy of these varies considerably, not to mention the fact that some of them only support IPv4. Any of these options are going to be slow though, as you'll have to check on every request. You also have to make sure you keep the databases up to date.
Another option would be to proxy your site through something like CloudFront or CloudFlare which both support blocking traffic by country.

IIS performance query while hosting multiple applications

I have developed Web App and Web API in .Net Core 2.0 along with Xamarin Mobile App. I am looking for best hosting strategy so that I can have best cost effective performance. Basically I need to host two stuff
Web App
Web API.
Questions:
Should I use different domain for both applications. i.e. www.myapp.com & www.myapi.com. or
I should use subdomain or directory for webapi. i.e. www.api.myapp.com or www.webapi.com/api
Confusion:
I have windows dedicated server with average configuration. Per my understanding, In both case all traffic will route to the same server. No matter I start with question 1 or 2.
Please advice.
With a single server it makes little difference which option you use. However domains/subdomains make it easier to scale/replace 1 or both components in the future.
Ask yourself:
Do you expect your app/api to ever require more than 1 server?
Do customers/3rd parties integrate with your api url directly?
If you answer yes to either question different domains/ subdomains probably make more sense.
Ideally within IIS I would have 2 seperate websites. One for www.example.com and a 2nd site api.example.com.
You should also think about a cdn (cloudflare ect) as this will help reduce load on you server and make static files load faster for end users.

Do I need an domain name for a website?

I want to create a website for myself that no one else will use at the moment.
Do I need to get a domain name to be able to access the website remotely or can I just use the host IP address when I want to go on it?
It depends on what you're looking to do. For example, Ruby on Rails and Sinatra languages can be locally hosted. So you can basically create the website without ever having to 'push' it to a domain. You'll definitely need a domain if you want to access it remotely - the domain name is basically a mask for an IP address anyway, so they're really somewhat the same.
You can also have basic JavaScript (JS) /HTML/CSS sites locally hosted as well. So you don't really need a domain, until you want people to actually start showing up to it remotely.
Hope this helps!

How do you limit access to a site by geographical location?

I need to come up with a way to limit users' access to a page to IP addresses within North Carolina. This has to do with usage rights for some MP3 audio. Are there companies that provide this service or is there a list of IP address ranges for a geographical location? This is on a Unix, JBoss/Seam environment. Thanks.
Despite the fact that is not a good idea (users can use a proxy and bypass this restriction), you can find many services googling for it: http://www.google.com/search?client=ubuntu&channel=fs&q=ip+geolocation&ie=utf-8&oe=utf-8
As far as I know, http://www.maxmind.com is one of the best availableand is used in sites like Sourceforge.
You should implement this restrictions on your application not your server via .htaccess files.
I doubt such a list is available. You can check the register information from the IP address you receive which resolves to the ISP of the user (not very accurate).
But there is always a way to bypass this using proxy services like proxy.org (or google proxy)
use geoip by http://www.maxmind.com/
they have both free and subscription-based services (more precise)
You can try ip2location, and from that list try extracting specific providers in North Carolina. When you check the IP, you can query that list to get the provider and check if that provider in that area or not.
Hope this helps.

How to simulate browsing from various locations?

I want to check a particular website from various locations. For example, I see a site example.com from the US and it works fine. The colleague in Europe says he cannot see the site (gets a dns eror).
Is there any way I can check that for my self instead of asking him every time?
This is a bit of self promotion, but I built a tool to do just this that you might find useful, called GeoPeeker.
It remotely accesses a site from servers spread around the world, renders the page with webkit and sends back an image. It will also report the IP address and DNS information of the site as it appears from that location.
There are no ads, and it's very stream-lined to serve this one purpose. It's still in development, and feedback is welcome. Here's hoping somebody besides myself finds it useful!
Sometimes a website doesn't work on my PC and I want to know if it's the website or a problem local to me(e.g. my ISP, my router, etc).
The simplest way to check a website and avoid using your local network resources(and thus avoid any problems caused by them) is using a web proxy such as Proxy.org.
Well, DNS should be the same worldwide, wouldn't it? Of course it can take up to a day or so until your new DNS record is propagated around the world. So either something is wrong on your colleague's end or the DNS record still takes some time...
I usually use online DNS lookup tools for that, e.g. http://network-tools.com/
It can check your HTTP header as well. Only a proxy located in Europe would be better.
Besides using multiple proxies or proxy-networks, you might want to try the planet-lab. (And probably there are other similar institutions around).
The social solution would be to post a question on some board that you are searching for volunteers that proxy your requests. (They only have to allow for one destination in their proxy config thus the danger of becoming spam-whores is relatively low.) You should prepare credentials that ensure your partners of the authenticity of the claim that the destination is indeed your computer.
DNS info is cached at many places. If you have a server in Europe you may want to try to proxy through it
It depends on wether the locatoin is detected by different DNS resolution from different locations, or by IP address that you are browsing from.
If its by DNS, you could just modify your hosts file to point at the server used in europe. Get your friend to ping the address, to see if its different from the one yours resolves to.
To browse from a different IP address:
You can rent a VPS server. You can use putty / SSH to act as a proxy. I use this from time to time to brows from the US using a VPS server I rent in the US.
Having an account on a remote host may or may not be enough. Sadly, my dreamhost account, even though I have ssh access, does not allow proxying.
The only thing that springs to mind for this is to use a proxy server based in Europe. Either have your colleague set one up [if possible] or find a free proxy. A quick Google search came up with http://www.anonymousinet.com/ as the top result.

Resources