Skip to main content

How to Change the Port of the Analytics Server

Reassign the Analytics Server to a different port and update Nginx routing so ServiceOps continues to serve reports, dashboards, and widgets without interruption.

The Analytics Server runs on port 8081 by default. You may need to change this port to resolve a conflict with another service on the same host or to align with your organization's port allocation policy. This guide covers the full change: updating the Analytics Server configuration, updating every Nginx proxy rule that references the old port, and verifying the service after restart.

Prerequisites

  • Root or sudo access on the ServiceOps server
  • A confirmed available port that does not conflict with any running service (see the port reference table below)
  • A maintenance window, as restarting services will briefly interrupt Analytics features

Default port assignments in a standard ServiceOps deployment:

PortService
8080Main Backend (ServiceOps)
8081Analytics Server (default)
8082Discovery Server
8000Chat Server
6060File Server
5432PostgreSQL
6379Redis
80 / 443Nginx
Avoid Port Conflicts

Do not assign a port already in use by another service. Assigning a conflicting port will prevent the Analytics Server from starting and may break reports and dashboards.

Steps

Step 1: Configure the New Port on the Analytics Server

Open the Analytics Server properties file and set the new port.

  1. Open the configuration file:

    vi /opt/flotomate/cm-analytics/application-custom.properties
  2. Add or update the server.port property:

    server.port=<new-port>

    Example: To move the Analytics Server to port 8083:

    server.port=8083
  3. Save and close the file.

Step 2: Update the Nginx Configuration

The Nginx configuration at /etc/nginx/conf.d/fmt_nginx.conf contains multiple proxy_pass directives that route Analytics traffic to the old port. Update every one of them to the new port.

Open the file:

vi /etc/nginx/conf.d/fmt_nginx.conf

Update all Analytics proxy rules as listed in the table below:

Nginx LocationOld proxy_passNew proxy_pass
/api/analytics/report/downloadhttp://localhost:<old-port>/api/analytics/report/downloadhttp://localhost:<new-port>/api/analytics/report/download
/api/analytics/public/(.*)/charthttp://localhost:<old-port>http://localhost:<new-port>
/api/analytics/downloadhttp://localhost:<old-port>/api/analytics/downloadhttp://localhost:<new-port>/api/analytics/download
/api/analyticshttp://localhost:<old-port>/api/analyticshttp://localhost:<new-port>/api/analytics
/api/analytics/download/.+/listhttp://localhost:<old-port>http://localhost:<new-port>
/api/analytics/report/.+/previewhttp://localhost:<old-port>http://localhost:<new-port>
/api/analytics/widget/previewhttp://localhost:<old-port>http://localhost:<new-port>
/api/analytics/widget/downloadhttp://localhost:<old-port>http://localhost:<new-port>
/api/analytics/download/dashboard/printhttp://localhost:<old-port>http://localhost:<new-port>
/api/analytics/public/user_survey_response/widget/previewhttp://localhost:<old-port>http://localhost:<new-port>
/api/analytics/download/printhttp://localhost:<old-port>http://localhost:<new-port>
Do Not Modify the Main API Location

Do not change the location /api block that proxies to http://localhost:8080/api. That block routes traffic to the Main Backend, not the Analytics Server.

Nginx Location Reference

The 11 Analytics location blocks and their purpose:

  1. Report Downloadlocation /api/analytics/report/download
  2. Public Chart APIlocation ~ /api/analytics/public/(.*?)/chart
  3. Analytics Downloadlocation /api/analytics/download
  4. Main Analytics APIlocation /api/analytics
  5. Download List (Regex)location ~ ^/api/analytics/download/.+/list$
  6. Report Previewlocation ~ ^/api/analytics/report/.+/.+/preview$
  7. Widget Previewlocation /api/analytics/widget/preview
  8. Widget Downloadlocation /api/analytics/widget/download
  9. Dashboard Printlocation /api/analytics/download/dashboard/print
  10. Public Survey Widget Previewlocation /api/analytics/public/user_survey_response/widget/preview
  11. Print Downloadlocation /api/analytics/download/print

Before and After Example (Port 8081 to Port 8082)

The example below shows the complete Nginx configuration before and after changing the Analytics Server port from 8081 to 8082.

Before (port 8081):

location /api/analytics {
proxy_pass http://localhost:8081/api/analytics;
}

location /api/analytics/report/download {
proxy_pass http://localhost:8081/api/analytics/report/download;
}

location /api/analytics/download {
proxy_pass http://localhost:8081/api/analytics/download;
}

location ~ /api/analytics/public/(.*?)/chart {
proxy_pass http://localhost:8081;
}

location ~ ^/api/analytics/download/.+/list$ {
proxy_pass http://localhost:8081;
}

location ~ ^/api/analytics/report/.+/.+/preview$ {
proxy_pass http://localhost:8081;
}

location /api/analytics/widget/preview {
proxy_pass http://localhost:8081;
}

location /api/analytics/widget/download {
proxy_pass http://localhost:8081;
}

location /api/analytics/download/dashboard/print {
proxy_pass http://localhost:8081;
}

location /api/analytics/public/user_survey_response/widget/preview {
proxy_pass http://localhost:8081;
}

location /api/analytics/download/print {
proxy_pass http://localhost:8081;
}

After (port 8082):

location /api/analytics {
proxy_pass http://localhost:8082/api/analytics;
}

location /api/analytics/report/download {
proxy_pass http://localhost:8082/api/analytics/report/download;
}

location /api/analytics/download {
proxy_pass http://localhost:8082/api/analytics/download;
}

location ~ /api/analytics/public/(.*?)/chart {
proxy_pass http://localhost:8082;
}

location ~ ^/api/analytics/download/.+/list$ {
proxy_pass http://localhost:8082;
}

location ~ ^/api/analytics/report/.+/.+/preview$ {
proxy_pass http://localhost:8082;
}

location /api/analytics/widget/preview {
proxy_pass http://localhost:8082;
}

location /api/analytics/widget/download {
proxy_pass http://localhost:8082;
}

location /api/analytics/download/dashboard/print {
proxy_pass http://localhost:8082;
}

location /api/analytics/public/user_survey_response/widget/preview {
proxy_pass http://localhost:8082;
}

location /api/analytics/download/print {
proxy_pass http://localhost:8082;
}

Save and close the file.

Step 3: Test the Nginx Configuration

Before restarting, validate the Nginx configuration syntax to catch any errors:

nginx -t

A successful test produces:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Do not proceed to the next step if nginx -t reports errors. Fix any syntax issues first.

Step 4: Restart Services

Restart the Analytics Server and reload Nginx to apply the changes:

systemctl restart ft-analytics-server
nginx -s reload

Step 5: Verify the Change

Confirm the Analytics Server is listening on the new port and responding correctly:

ss -tulnp | grep <new-port>

Then test the Analytics API endpoint directly:

curl http://localhost:<new-port>/api/analytics

A valid JSON response confirms the server is up and routing correctly.

Result

The Analytics Server runs on the new port. Nginx routes all Analytics API requests, including report downloads, dashboard print, widget previews, and public chart endpoints, to the new port. Reports and dashboards in the Technician Portal load without errors.

Troubleshooting

Analytics Server fails to start after the port change

Cause: The new port is already in use by another process.

Fix: Run ss -tulnp | grep <new-port> to identify the conflicting process. Choose a different port that is not in the default port table, update application-custom.properties with the new value, and restart the service.

Reports or dashboards return errors after the change

Cause: One or more proxy_pass entries in fmt_nginx.conf still reference the old port, or the Nginx reload was not applied.

Fix: Run grep <old-port> /etc/nginx/conf.d/fmt_nginx.conf to find any remaining references. Update them to the new port, run nginx -t to validate, and then run nginx -s reload.

nginx -t reports a syntax error after editing fmt_nginx.conf

Cause: A proxy_pass line was edited incorrectly, such as a missing semicolon or malformed URL.

Fix: Run nginx -T | grep analytics to inspect all Analytics-related directives. Compare each line against the reference configuration in Step 2 and correct any formatting errors before reloading.