How to run glassfish 4 on port 80 instead of 8080? root access is not an issue

北城以北 提交于 2019-11-27 06:49:35
Alexandre Jacob

To run GlassFish on port 80 you need to :

  1. Connect to the administration interface (by default on port :4848)

  2. In the left menu go to Configurations

  3. Then select the appropriate configuration you need to change eg server-config

  4. Then go to Network Config

  5. Then go to Network Listeners

  6. Select the appropriate listener, probably http-listener-1

  7. Change the Port value to 80

  8. Save and reboot your GlassFish server/instance/cluster according to your needs

Using the command line utility

asadmin set configs.config.server-config.network-config.network-listeners.network-listener.http-listener-1.port=80 

you may need to replace server-config and/or http-listener-1

mukul anand

Go to glassfish4\glassfish\domains\domain1\config folder and here open domain.xml file and find tag

<network-listeners>
    <network-listener port="9999" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
</network-listeners>

in port attribute of <network-listeners> you can specify your port address whichever you want.

Here's another approach.

You can go to the admin console under port 4848 (I am using Glassfish 4.1.2) and navigate to "Configuration" > "server-config" > "HTTP Service" > "Http Listeners" > "http-listener-1" in the left hand navigation.

Click on the "http-listener-1" link in the main content window.

Change the port to desired number and save.

Restart Glassfish and run your application.

in some cases you have to change port before glassfish is started (in my case port 8080 is already in use by another instance) so answer 4 worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!