I am creating a dynamic web project in java. I want to deploy it in a application server. By default we have hostname as localhost:port/appname. I want to change it to localhost.com/myapp. How can i do that? Do i need to change something in my project or tomcat or hostfile. Please elaborate.
I fear there may be some confusion about how web servers work.
In your browser the URL http://localhost:8080/application_name will resolve internally to 127.0.0.1 (localhost) as this is a built in address. 127.0.0.1 is a loop back address pointing to the machine you're on. If you're hosting the server on the same machine as the you're trying to navigate to this is why the localhost address works.
If you were on another machine you would need to either directly input the IP address of the server or use a DNS record to point the IP address to a URL you own and control.
Browser are also programmed to default to port 80 for http and port 443 for https so if you don't want to have to provide a port have your server bind to port 80. This way you'll only need to navigate to http://localhost/application_name
When deploying the application to a server you want to be externally accessible you'll purchase a domain, register the DNS record and point it at servers external IP address (You may need to configure firewall and network rules).
Related
I have a Java SpringBoot app running fine on localhost and it is accessible from any device connected to the same WI-FI. However, if I set server.address to my public IP address in application.properties and try to start my server, I get an error saying my 8080 port is in use.
What could be the problem?
I am using Windows 10.
Thank you!
To make your app accessible you don't need set server.address. Maybe if you use home router, you must try configure port forwarding for 8080 on router
Firstly, you need to make sure you do all of the below:
start your spring boot run on your local IP - if you are using windows open your cmd and type the following: IP config and check your ip
server: port: 8082 address: 10.0.0.x
(or 192.x.x.x) something like this
Make sure your firewalls are disabled for incoming requests. If you are using windows again go to firewall management and disable.
Go to your ISP management (router management) usually when you type your local IP in address bar of browser it will take to your router login from there find an option which says port forwarding and forward it to your port (in this case - 8082) and select your machine as the destination for all incoming requests to that port.
Finally just login from an external machine other than your network to test it out do the following: To find your public IP(just google whatsmyIP)
a.Test some get endpoint (publicip:8082/users) something like this
I am using a hosting service to have my minecraft server run.
I was wondering if it was possible to "forward a port" to a url. ie:
change 25561 to 25565 so that the minecraft client reads the url and the users don't have to put in the port of the website.
A record: play.mydomain.tk 94.23.16.94
I want it so that when users put in the url on the minecraft client(which, if not defined, automatically selects port 25565) don't have to put in the custom port.
Not sure if there is a way to do this.
I am aware Apache can use VHosts to host on the same server with the same port, but there must be some way to do this with other servers.
What you need is a SRV record to forward the minecraft 'service' to the right port on your hosting server. I'm doing this with mc.jgsw.me (which forwards to port 25569) and it took me flipping ages to work out.
If, as stated above, some other piece of software is already using port 25565 on your IP address, then it will be impossible to use that port on your Minecraft server without using a different IP address.
You could set up some sort of gateway that redirects traffic to server.example.com:25565 through to your server at x.x.x.x:25561 and vice versa. This could be in the form of an SRV entry on a DNS server. You would need to own the domain to do this, but some domains can be very cheap. More info here from an SRV provider.
I am trying to look the web application I made with Java EE. The server and database is up and running. It works on localhost:8080, but when I replace localhost with the local IP address all I get is a 404 error. Do I need to configure something?
On windows 7 open the firewall to allow incoming and outgoing traffic on port 8080. Then from the remote machine make sure that you can ping the server's ip address and then try to browse to the address.
I have already deployed my web application on GlassFish at http://localhost:8080/Elibrary/.
So how can I configure my server to make "Elibrary" accessible from the Internet?
I know that in ASP we can use IIS to alias the from domain.
Could someone please let me know or point me to some documentation?
If you are hosting in your network, then you have to get IP of the machine which is running your app i.e. is your local ip inside ur network. To get your ip, run ifconfig on mac/unix/linux and ipconfig on windows.
Then go to your router settings. Generally every router has specific ip to access settings from browser like belkin has 'http://192.168.2.1'.
In your router settings you have to look for 'virtual servers', 'port forwarding' etc. The actual concept is port forwarding but different routers say it differently in the settings. These settings should be in firewall or security sections.
Once you found the settings, there you will have to tell the inbound port range and map it to the local ip (which we have above) and the outbound port range. It is saying that when ever a request comes on the router on the inbound port range then forward that request to local ip and port range. In your case, the port range will be to (for both inbound and outbound). Note that some routers dont have range for ports instead only have one port per entry, so you just have to put .
NOTE: To get the IP for settings of your router, try this site.
I hope this is what you looking for.
Nginx or Apache will work will in that scenario, processing virtual hosts and forwarding to an external application. Example for nginx.
Put this in place of the server section in an existing config file, unless using Debian/Ubuntu or other system where the server configurations are split into their own files.
server {
listen ip:80;
server_name virtualhostname.tld;
location "/" {
proxy_pass http://localhost:8080/;
};
};
Now http://virtualhostname.tld/Elibrary will work to access your application.
You can add rewiriting to get rid of Elibrary, and you find Apache equivalents of this online.
I'm developing with Java GAE and Google API's with OAuth authentication that requires an URL Callback that receives the access tokens.
To test locally, running Jetty in 127.0.0.1:8888/home.html?gwt.codesvr=127.0.0.1:9997, I've configure a DynDNS domain and set my router to redirect traffic from port 8888 to my machine.
When I do that DynDNS domain shows my router web configuration page, like I was browsing to my router local IP.
I've achieved a workaround activating my StrongVPN account to trick the router loopback, but when DynDNS refresh the VPN IP I can't access anymore, well I have to wait a lot of time to do the trick again.
How can I avoid these loopback connections? Should I set up a proxy? Anyone has met this scenario (local debug GAE+G.APIs+OAuth)?
Edit:
I'll show you my LAN configuration (trying to discard causes):
INTERNET (WAN IP) <-> ISP Router (192.168.1.1) <-> (192.168.1.2) Neutral Router (192.168.0.1) <-> (192.168.0.XX manual static IP) MacBook Local Server
I set this port forwarding configuration in my ISP Router to redirect the incoming port 80 connections to my 8888 port
- TCP port 80 to 192.168.1.2 port 8888
I set this port forwarding configuration in my Neutral Router
- Port 8888 to 192.168.0.XX
The configuration described would be OK because if I access through my mobile 3G connection to mydyndns.dyndns.org I access to Eclipse local web server.
Then, I tried to edit host file as Owen "point your DynDNS domain to 127.0.0.1" says but without success :(
If I set '127.0.0.1 mydyndns.dyndns.org' in my hosts file dyndns domain doesn't work, I think is because port forwarding, but I receive a not found, as if I type 127.0.0.1 in the browser. Eclipse server is attaching 127.0.0.1:8888 then port 80 doesn't have nothing to show.
If I set '127.0.0.1:8888 mydyndns.dyndns.org' in my hosts file I access to the ISP Router web configuration page as I was typing 192.168.1.1. But the address is inmediately replaced on the browser address bar for MY_WAN_IP:80
Then I think that a connection loopback is happening. Any idea about how to fix that :(?
You could edit the hosts file on your machine to point your DynDNS domain to 127.0.0.1 That's what I do.
The location of the hosts file depends on your operating system. Check the Wikipedia article to find it's location in your OS and how to edit it.
In addition to editing your hosts file, I think you can follow the advice in this question/answer to locally forward. https://serverfault.com/questions/102416/iptables-equivalent-for-mac-os-x
I change my ADSL Provider and the main router, with that I reconfigure the scenario as the documents says and it works.
I'm sorry for so specific question, that was a ISP problem who, for any reason, don't support or has any undocumented custom configuration to configure your own server.
Thanks
I fixed this problem by connecting to my ADSL Router via Telnet (the command after you're in telnet is "o router-web-configuration-ip-here") and then I issued the commands to check NAT loopback ("ip nat l"), after verifying it was off I issued the command to turn it on ("ip nat l on"). You can also edit the autoexec.net ("sys edit autoexec.net", "n" [twice], "ip nat l on", "x" ) of the router to make the change permanent.
I also did edit the HOSTS in my machine, placing my server's own local IP tied to the DynDNS host.
I'm using Windows 7 for development, I don't know about your specific configuration, but this might help others doing SO/HO dev.