proxying outgoing traffic from local network - linux

i have the following case: i've had an app hosted on some cloud hoster's server and it's own domain, now i've migrated from cloud to selfhosted and what i want to do is to redirect all users in my local network from the old domain to the new one i.e. when a user tipes previous url into it's browser it opens new urk. The main problem is that i can't influence on the old domain, but can configure my local proxy server apache.

There are 2 ways to achieve that:
The simplest way is to edit the hosts file on your local network computers (on windows you can find it in c:\Windows\System32\Drivers\etc\hosts (or /etc/hosts on Linux) and add the entry for your olddomain internalserverip like "IP_ADDRESS DOMAIN_NAME www.DOMAIN_NAME".
You will need to create a bind server on your local network to answers the local queries and configure the zone for your old domain like you would when the domain was hosted on cloud, you just need to put your internal server IP in the A entries.
In both situations if your web server is configured with only the new vhost entry , you will need to configure it with the old vhost (if there is no vhost configure you will not need to do anything)

Related

How to add subdomain pointing to other website on same server

I have 2 websites I want to run on one virtual machine.
One is a NodeJS server, the other an Nginx server.
The main website website.example points to the NodeJS server.
Now I want a subdomain like shop.website.example to point to the Nginx server.
The virtual machine is in Azure.
I've read that it's not possible to link a subdomain to a specific port, so that's already not possible.
Would it be possible to have different IP's that go to the website, and would route to the right server based on the IP that is being used?
As far as I know, if you want to access the two websites in the same Azure VM, It's possible to use two DNS records to map to your Azure VM.
First of all, the two websites should listen on different ports. Then you can use A record to map the domain name website.example to the Azure VM public IP address. A CNAME record maps the subdomain name shop.website.example to the Azure VM FQDN. You should bind the different hostname of the websites with different ports on the Azure VM.
Also, make sure you could access the website outside of Azure. You could check the NSG rule or local firewall or website is listening for 0.0.0.0 on the Azure VM.

Web site host with url in iis

I'm going to host a web site in one of my computers toaccess it from the another computer. (Same local network) This what I have done so far.
Step 1 : Host the web site in IIS.
Step 2 : Using "Edit bindings" I changed the host name.
Step 3 : Then I changed the host file located at "C:\Windows\System32\drivers\etc"
192.168.8.100 mylocalhost.com
Step 4 : Turn off both private and public windows firewalls. (I know this is bad. But for now its fine. I can add inbound rules after resolving this issue)
I try to access to the url http://mylocalhost.com:8082 using hosted environment. It is success, but when I try to access that url from the other computer(in the same local network) it cannot be access. Without the above binding name (mylocalhost.com), I can access to the web site using http://192.168.8.100:8082
I want to access to the website using a url with any computer/mobile device connected to the local network. Can anyone show me a direction to resolve my issue?
Environment Information
Windows 10
IIS (version 10)
Your problem is step 3 - your assumption that the host file on a single client computer will apply to all computers on your network. You need a server of some description for the behaviour you describe.
A hosts file is only used by that single computer to resolve or override dns. Each computer has it's own file and there is no default way of sharing this file with other computers on the network. Your choices are:
Add the host file entry to each device.
Setup a DNS server. your router might support this, and is likely providing the DNS server to your clients via DHCP so no additional config would be nessersary. Just login to its web interface and configure the dns name. If your router cant do it for you you would need a DNS service running on one of your computers and then configure either your routers dhcp/dns to use this new DNS service, or manually configure all clients to use the new DNS for their DNS resolution.
Setup an active directory server and join all your pcs to the domain (setting up AD includes a DNS server).
Some Public DNS providers allow you to specify a private ip in public dns. So assuming you owned the domain example.com you might be able to create an A record my.example.com for your 192.168.8.100 ip address. This would be public, but only devices on your private network would actually be able to connect to your server (ie different physical computers/networks that happen to use the same internal ip).

How to get a host name for my web server

I have set up an ubuntu server on my local network. I have set up port forwarding on my router so that my tomcat application server that I have running on my ubuntu server can be publicly accessed at:
http://<my router's IP>:8080/
Is there a free way to create a domain name so that my app server will be publicly available at something like http://example.com, rather than http://<IP>:8080?
You can use a CDN service (like CloudFlare, which has a free tier) to reverse-proxy from a domain name of your choosing to your server. There are some limitations but if you aren't doing a lot of live updating or have interactive pages this might be a good route.
Other than that, a redirection service (that would turn your http://example.com into something like http://website.example.com:8080 after the first hit) or a custom reverse proxy (like HAProxy on a $5/month AWS t2.nano instance) might be a non-free option.

Plesk 12 - Access domain/webspace before DNS point to server

I'm using Plesk 12 to manage my domains and websites. At the moment I need to move a website from another provider to me.
Before I change the DNS entries to point to my server. I'd like to check if everything is working correct. So is there a way to access a webspace with a domain set up, that is actually not pointing to my server?
If you have Linux on your local computer, you can edit the hosts file and add the domain and IP address of the new server.
Remember to add your domain to new plesk.
Your web browser will direct you to your client website with the new provider.

Can a managed website and a virtual machine share the same domain name in Azure?

I have a website hosted on Azure as a managed site. I need to run a separate FTP server and a custom Windows service on virtual machine, but need them to share the same domain name as the site. So what I'd like to be able to do is have mysite.com port 80 go the website, but mysite.com port 21 etc go the virtual machine and connect with the FTP service. How would I go about setting that up?
When a user looks up "mysite.com" they are going to get a single IP address, and there is no way via DNS to return different IP addresses based on the port number you are trying to use. You have a couple options to achieve this solution:
Setup an intermediate routing service that accepts all traffic to mysite.com and then routes the traffic to the appropriate website/VM based on the port number. This is non-trivial and may incur extra costs (you could build the routing service into the existing VM that is serving FTP to reduce the cost).
The easier solution is probably to have a CNAME for www.mysite.com pointing to the website, and a CNAME for ftp.mysite.com pointing to the VM.

Resources