I want to share a new trick of changing Port number of running AEM instance on the fly without renaming port number in Jar file or changing port number in debug.bat file .
Run mode of AEM instance can be anything in this case whether author , publish , sample-content or any custom like prod . Only prerequisite is AEM instance up and running .
Kindly follow Important Note section at bottom also seriously after following below mentioned steps else instance may become corrupt.
To achieve this , Following steps needs to be followed .
1.) Open the Configurations tab in Apache Felix Web Console or simply open http://<host>:<port>/system/console/configMgr
2.) Search for Apache Felix Jetty Based Http Service and Open it.
Console appears like as mentioned in screen shot.
3. As pointed Arrow Suggests HTTP Port by default is 8080 , change this port number to example 6502 or 9502 as per your requirements.
4. If you changed HTTP Port to example 6502. Open http://localhost:6502 in new tab and your AEM instance will run in new Port number i.e . 6502 .
1.) Before closing your AEM instance if you are working on new port number as defined in Jetty service, kindly again open http://<host>:<port>/system/console/configMgr , where port is your new port number example 6502 , go again to Apache Felix Jetty Based Http Service and change port number in HTTP Port to Original Port number of your instance defined in Jar or debug.bat file example 4502 in this case which was changed to 6502 , else after closing your AEM instance with new port number and again opening AEM instance , it becomes corrupt and inaccessible.
2.) These changes persists as long as your AEM instance is up and running . As soon as you close your instance , next time CQ/AEM will open in port number defined in Jar file or debug.bat file after following Point 1 in Note.