Reputation: 177
Can anyone tell me about glassfish server domain name for webapplication(struts2).
Now i am using my URL to run web application is:
http://localhost:8080/testapplication/
I want to change this URL to run my application as:
http://www.testapplicaiton.com/
So i need in help to change this domain name in Glassfish server. thanks in advance.Please provide your help.
Upvotes: 3
Views: 8783
Reputation: 1
Edit your the hosts file at the following path: c:\windows\system32\drivers\etc\hosts file At the end add entry as your PC IP 192.168.2.4. I ONE SPACE followed by www.testapplicaiton.com and save the file and Restart PC. your PC IP can be found at C:\ipconfig/all (Press Enter Key) Note down the IPv4 IP Address. Note: while editing start the Note pad in the Administrator Mode. You can test your website ONLY on LAN not on INTERNET. For Internet you need a domain www.testapplicaiton.com and STATIC ip and then PORT FORWARDING ON SPECIFIC PORT ON YOUR ROUTER. ALRIGHT then, Get set and Go!!! Good Luck2U.
Upvotes: -3
Reputation: 2288
Create a file sun-web.xml with the following content
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN"
"http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app>
<context-root>/</context-root>
</sun-web-app>
and put it into the WEB-INF directory. This will allow you to get rid of 'testapplication' in your URL.
You also have to change port numbers to standard. There are several ways to do it. One of the them is to go to the web console of the application server then
Configuration->Network Config->Network Listeners
You have to provide 80 for Port parameter of the http-listener-1 and 443 for Port parameter of the http-listener-2 This allow you to get rid of the port number '8080' in your URL
(However the faster way is merely to make search in the domain.xml config file for '8080' and change port numbers there)
After these changes your application will respond on http:/ /localhost and https:/ /localhost
The domain name 'www.testapplicaiton.com' has nothing to do with Glassfish. You have to use DNS.
Upvotes: 5