UniFi controller by default uses these ports:
- unifi.shutdown.port=8081 # for management purpose
- unifi.http.port=8080 # device inform
- unifi.https.port=8443 # controller UI / API
- portal.http.port=8880 # portal redirect port for HTTP
- portal.https.port=8843 # portal redirect port for HTTPs
- unifi.db.port=27117 # local-bound port for DB server
- unifi.stun.port=3478 # UDP port used for STUN
If you have one of these ports already taken UniFi won’t start, you won’t see an error in /var/log/unifi/server.log and during installation it will remain stuck in starting.
These ports are configurable via system.properties file, which by default resides in /usr/lib/unifi/data. The file is created at first successful start, so if one of these ports are taken on your system the best way to go is:
- stop services using the ports above;
- install UniFi controller;
- change UniFi controller ports.
That’s pretty easy: just open /usr/lib/unifi/data/system.profile and adjust the parameters above (even by adding them, if they don’t exist) and then restart unifi.
If you cannot stop the service using one of the ports above and the installer is pending start you can generate the system.properties file by running:
sudo -u unifi java -jar /usr/lib/unifi/lib/ace.jar discover
After running this command you can proceed as above in changing the UniFi ports.
The installer might remain stuck, tough! This because the init script checks if the service has started by connecting to http://localhost:8080/status. If you changed unifi.http.port the init will not be updated and will continue trying accessing that port. To let it complete just kill the process running unifi start and the installation will finish successfully.
Now just restart unifi to make sure it uses the new ports!
UniFi KB article here.