How to Change the Port of Main and Nginx Server?
Main Server (Tomcat)
To change the default port (8080) of Main Server, follow the steps below:
For example: If you want to change the default port from 8080 to 8082,
Step 1: Go to the Main-Server Config folder using the below path:
/opt/flotomate/main-server/config/application-custom.properties
Enter the following command:
cd /opt/flotomate/main-server/config/
Step 2: Edit and save the below properties key by using the below format:
Key: server.port=YOURPORTNUMBER
For example: server.port=8082
OR
You can also use the below command if you are not familiar with vi, vim, and nano.
Command:
echo "server.port=YOURPORTNUMBER" >> application-custom.properties
For example:
echo "server.port=8082" >> application-custom.properties
Step 3: Next, restart the main-server and Nginx services to replicate the changes using the below commands:
systemctl stop ft-main-server
systemctl stop ft-analytics-server
systemctl restart nginx
Nginx Server
To change the port of the Nginx server,
Step 1: Edit and save the nginx config file to update the port number. You can find the config file from the below path:
/etc/nginx/conf.d
By default, the Nginx server runs on port 80 and 443.
Step 2: To change the port, kindly edit the file as per your port number.
For example:
If you run nginx on port 8080(HTTP) and 8443 (HTTPS), edit the ports as shown below:
listen [::]:8080;
listen 8443 ssl;
listen [::]:8443 ssl;
Step 3: Once done, save the config file, and restart the Nginx service using the below command.
systemctl restart nginx
The ServiceOps URLs will appear as shown below:
For example:
HTTP URL: http://dummy.com:8080/
HTTPS URL: https://dummy.com:8443/
The allowed port commands are:
ufw allow 8080
ufw allow 8443
Before updating, kindly take the backup of the config file.