Directing Domain Name to Tomcat - apache

I am developing web pages and deployed it in Tomcat. I want it to share among my friends. I read about IIS and Apache.Please suggest me any way to direct domain name to tomcat installed in my computer.

Personally, I would stay away from IIS.
Deploy an instance of Apache/HTTPD in windows - and proxy/reverse-proxy the traffic on whatever port you want to your tomcat instance.
You can find some decent resources as for Windows deployables here:
https://httpd.apache.org/docs/current/platform/windows.html
Then when you have your server set up and functioning, look into the ProxyPass directive within Apache.
https://httpd.apache.org/docs/current/mod/mod_proxy.html
Don't forget to open a port forwarding on your router, if necessary.
As far as directing your domain name to your computer, look into getting an account at ZoneEdit to set up your DNS to point whatever domain name you want to your routers/cable modems IP address. Then you can set up your port forwarding.

Related

Accessing localhost (xampp) from another computer

First, I already searched stack overflow and followed the suggestions in previous answers, such as How do I connect to this localhost from another computer on the same network?
I have created a PHP/MySQL application for a client. The want to host it locally on that server.
The machine in question is running an application written in another langauge (I'm not sure which one) and running Tomcat on port 8080.
They also do not have separate staging/production environments, so this is not ideal.
Their other web application needs to remain running while I also port over the new app. I installed XAAMP onto their system and got the app running locally using Apache HTTP. However, they want other computers both within and outside their networks to be able to connect to the Windows server as well. They are already doing this for the previously created app that is running on Tomcat.
Ports 80 and 8080 are already being used, so the firewall was updated to allow my application to run on port 8086.
I used ipconfig to the find the local IPv, and then tried updating the http.conf and vhost file and am listening to the IP on port 8086. However, going to the IP/foldername doesn't resolve on another computer in the network. As a test, I also just typed in the IP of the windows machine, and it never resolves.
I generally don't implement of windows; until now, all of my production applications have run on some flavor of unix. Their other application is live and I don't want to disturb it. They access it by going to {servername}:8080. I tried server:8086 to see if my app could be accessed that way, but it can't.
I confirmed that localhost/foldername resolves.
Here are the exact steps that I have taken. I tried two different solutions.
Solution 1, using How do I connect to this localhost from another computer on the same network? as a guide:
Make sure firewall allows port 8086 access
I modified the C:\xampp\apache\conf\extra\httpd-vhosts.conf file to include a virtual host for the application:
DocumentRoot "C:/xampp/htdocs/{foldername}"
ServerName dispatchserver
Went to the Windows host file located at \Windows\system32\drivers\etc\hosts and added the following:
192.xxx.x.xx dispatchserver
From a computer outside the network, tried to go to the following URLs (non resolved):
http://192.xxx.x.xx
http://192.xxx.x.xx:8086/
http://192.xxx.x.xx/foldername
http://dispatchserver
http://dispatchserver/foldername
Since they didn't work, I tried a solution using this older stack overflow answer: Accessing localhost (xampp) from another computer over LAN network - how to?
Made sure firewall allows port 8086 access
XAMPP control panel > Config > Service and Port Settings > Apache > Changed main port to 8086.
XAMPP control panel > Apache > Config > http.conf
Searched for "Listen 80" and replaced with Listen 8086
Right above that, added Listen 192.xxx.x.xx:8086 (I used the IPv4, but don't want to include full address for security reasons). I added this line with hashtag at first (#192.xxx.x.xx:8086) and then without hastag after that didn't work (192.xxx.x.xx:8086).
Searched for and set this up as the directory statement:
AllowOverride All
Require all granted
Restart Apache
What steps can I take to allow the new webapplication I installed via XAMPP to be accessible to other computers?
In that case it's a little different if you want to web enable this. You need to set up your router to port forward to your server (app)so that the other network can reach it from the internet. Your router blocks incoming requests by default so a port forwarding rule using the port you mentioned will work. You should also put your server computer (the one with the app) on a static ip address to make things easier. Then for the user to see your app you need to give them the ip address of your internet connection (seen via sites like ipchicken.com) and the port number in the url.
Normally you just need to open the ports in the windows firewall on both computers (inbound and outbound) for the ports your application is using and then connect to the other machine via ip address and port number if they are on the same network.

IIS sites can be viewed with http://localhost:port but not with local machine IP or loopback

I have googled this and found a lot of posts, but no definitive answer.
Basically, I want to play with making websites and set up a local virtual server with only IIS (v8.5) installed. It's not connected to the internet and it's purely for self education.
The problem is that I have sites working, different sites on different ports. All of these are viewable in a browser on the server if I use http://localhost:port-number as per the site's binding.
I can live with this - but I'm curious as to why, if I substitute the localhost with the server IP, or the loopback address the page can not be found. Clearly IIS is working as it serves pages with localhost.
I have added multiple bindings to a site so that 'all unassigned' the server ip and the loopback are bindings for the site on port 80.
As per some posts I've used CMD to add netsh add iplisten.
netstat - confirms the server ip is listening on all the ports of the websites created (3 sites, each with a different port number)
Firewall is disabled as it's only virtual server with no internet access.
I'm aware I can add a domain address and put this in the hosts file, but I'm really just curious as to why I can't browse the sites hosted in IIS locally by the server's IP or loopback.
Thanks in advance

How to set a custom website name instead of ip address for local computer?

I can point a url to a directory in my computer by setting /etc/host and /private/etc/apache2/extra/httpd-vhosts.conf files. For instance, when i type sample-app.com in my computer, website under /Users/azad/works/sample-app.com folder is running.
When someone type sample-app.com in another computer in same local network i want to display the same website located on my computer. Is this possible?
By the way, i don't have access to any computer in the local network and i can't do any configuration.
Mac 10.7.5 (I am using mac but if windows is better for this purpose i can use windows too),
PHP 5.3,
Apache 2.2
If you want to accomplish this on windows, use the hosts file on the computers you want to point at that sample-app.com URL mapping your IP address to that URL in all the computers you want that to work on. Then make sure your HTTP server is configured to serve that website under that host name for port 80.
Since you aren't able to configure the local network, the best way to handle this situation is to configure a host name with the website domain's DNS server, such as dev.sample-app.com, which points to the local IP address (seeing as how its on the local network) of the computer hosting the website. This will then allow other computers on the local network to enter this host name to access the webiste.
If you had control of the local network's DNS server or control of the proxy (if they have a proxy), there would, of course, be other options.
Update:
Since you mentioned in your comment that you have control over the DNS server, here is how you could accomplish your goal via the DNS server. First, add a forward lookup zone for sample-app.com to the DNS server. Second, configure the default host for the zone to point to the computer serving up the website content. Now the client computers will resolve the local IP when the user enters sample-app.com into their web browsers. If you need to continue to have access to other hosts on sample-app.com, you might want to try asking about it on serverfault.

How to set up an internal website?

How do I set up a website that's accessible within a small (office) network? I've only worked on localhost (using WAMP) so far and have no idea where to start. Also, is it possible to access that website through a pseudo domain name/alias instead of an IP?
This is of topic here - and wil be covered by lots of basic set up tutorials.
It's exactly the same process, except you need to ensure that clients on the lan can connect to the webserver runing on port 80 - i.e. make sure your firewall isn't blocking the access and that apache is listening on the LAN interface address (the default configs are usually to listen on all addresses).
is it possible to access that website...
Yes - just publish a DNS record for the webserver in your DNS server - or add it to the hosts files on all of the clients.

how to make apache server public

I want to convert my pc to a web server. I installed centos server and apache server.
How I can make apache server public? I want to everyone access my web site on my pc via browser.
Thank you..
You have 2 ways, you can buy a domain and a static IP address for your computer (usually through the service provider) and configure your router and FW to allow access to the machine for port 80.
The other way is to use some sort of dynamic dns service like DynDNS to be able to bind a DNS to a dynamic IP address (you will need to run a daemon to update the account once in a while because your IP may change). The FW and router rules are still needed in this case as well.
After you do one of the these steps everyone should be able to access your apache server on your computer as long as it's on.