How to change the port for GeoServer on Windows with Jetty

Faced with the task of upgrading a production GeoServer under heavy constant use, I decided to install the newer version alongside first, migrate the content, then make the switch when I was happy everything was working. I installed the new GeoServer 2.7.0 using the Windows installer, choosing port 8081 (the old version was running on port 8080), and electing to run it as a service. I cloned the data directory and pointed the new version at the new copy. Once the SQL Server extension was installed, everything appeared to be working fine – all layers working well. The only problem I could see was the the disk quota functionality was failing with visible warning messages in the GeoServer admin interface, and I guessed that this was probably because two different versions could not use the same disk quota database (this turned out to be correct).

The next step was to switch off the old version of GeoServer and present the new version on its address, minimising transition time. This required changing the port of the new version from 8081 to 8080, so I scoured the internet on how to do this. I found a few threads out there, but none gave me the right answer. They specifically mentioned \etc\jetty.xml and GeoServer’s startup.bat, neither of which configured the port for my installation. In fact the configuration is to be found against the Windows service:

GeoServer Windows service

Opening this service reveals the port specified in the command line (here showing after I had changed it):

GeoServer service commandline

Changing this command required editing the registry, with these settings found under HKEY_LOCAL_MACHINE\SYSTEM\ ControlSet001\services\GeoServer 2.7.0:

GeoServer service registry settings

Edit the command-line as follows:

GeoServer service command

I also edited the previous version to start on port 8081 (in case I needed to run both), then stopped the older version’s service and restarted the new version’s service. Everything worked fine, with an imperceptible transition. And as predicted, the disk quota thing started working too.

So that’s how to change the port for GeoServer running on Windows with Jetty!

Posted by Crispin Flower 19 April 2015 Categories: GeoServer IIS Windows Server 2008

Comments

05 October 2015

re: How to change the port for GeoServer on Windows with Jetty

Very useful article! 

16 October 2017
Alexandre

Very Useful Tip

Very useful thanks.

Just for information I Had also to modify wrapper.conf and write the config as 4th java additionnal parameter. So services AND geoserver proper configuration points to new chosen port.

 

Alex

Find out more