Skip to main content
Redis Default Port and Safe Changes - Virtarix Blog

Redis Default Port: How to Change Port 6379

June 5, 2026 · Blog / Technical Guides

Redis uses TCP port 6379 by default. Without a host or port option, redis-cli connects to 127.0.0.1:6379. If you change the server's port, update every application, worker, and monitoring check that connects to it.

A different port can resolve a local conflict or let you run multiple instances. It does not prevent unauthorised access. Review the listening address, firewall rules, authentication, and protected mode separately, and keep Redis inaccessible to untrusted clients.

The steps below show how to inspect the configured port and test a temporary instance before planning a production change.

Key takeaways

  • Redis uses TCP port 6379 by default.
  • redis-cli connects to 127.0.0.1 on port 6379 unless you pass another host or port.
  • On Ubuntu packages, the Redis server configuration file is commonly /etc/redis/redis.conf.
  • Test a custom port with a temporary instance bound to loopback, then connect with redis-cli -p 6380 PING.
  • Do not expose Redis directly to the public internet; bind it locally and use firewall rules.
  • For related VPS operations, see the Virtarix guides to how to secure a VPS, Linux command line habits, and managed vs unmanaged VPS hosting.

What Redis port 6379 means

Port 6379 is the conventional Redis TCP port. When a local app, queue worker, cache library, or redis-cli command points to Redis without a custom port, it is often assuming 6379.

That default is convenient, but it can hide configuration mistakes. If one app connects to the default port while another Redis instance was moved to a custom port, you may be testing the wrong server. Always verify both the host and the port when troubleshooting.

The port is only one part of the connection. A secure Redis setup also depends on which network interface Redis binds to, whether protected mode applies, whether the host firewall allows the port, and whether authentication is configured for your deployment.

Check the current port and test a new one

Step 1: install Redis tools for a local test

Use a disposable Ubuntu environment for this example. The package installation commands require root privileges; use sudo before each command when working from an administrator account.

Install Redis Server on Ubuntu
apt-get update
apt-get install -y redis-server

Package installation may start the default Redis service. Check the environment before starting a second instance, and use an unused port for the test.

Step 2: check the packaged Redis config path

On Ubuntu-packaged Redis, the Redis server manpage documents /etc/redis/redis.conf as the typical default configuration file.

Read the configured Redis port
grep -E '^port ' /etc/redis/redis.conf

On a production VPS, inspect the real config file used by your Redis service before editing anything, because custom deployments and containers may use a different path.

Step 3: test a custom Redis port safely

In the disposable environment, confirm that port 6380 is unused. Start a temporary process bound explicitly to loopback, test its response, and stop it afterward. Proceed to the client commands only if the new process starts successfully.

Start test and stop Redis on port 6380
redis-server --bind 127.0.0.1 --port 6380 --daemonize yes
redis-cli -p 6380 PING
redis-cli -p 6380 shutdown

A PONG response confirms a Redis connection on that port. The shutdown command stops the instance listening there, which is why this test must use a free port in a disposable environment. It does not establish that production authentication or network restrictions are correct.

Use this as a lab pattern, not as your production change process. For a real service, update the managed configuration, restart through your service manager, and verify the application’s connection settings.

Changing the Redis port in production

For an Ubuntu-managed Redis service, the production port is normally controlled by the service configuration file. The common line is:

Configure Redis to use port 6379
port 6379

Choose an unused TCP port and edit the configuration file the service actually loads. Update application connection strings, monitoring, and any relevant firewall rules, then restart through the service manager. If clients still use the old port, they will fail to connect even when Redis starts successfully.

Use a maintenance window if Redis backs sessions, queues, cache, rate limiting, or application state. Even a short Redis restart can affect user-facing behavior when the app depends on it.

Need safer VPS control for Redis exposure?

Run Redis-adjacent services on Virtarix VPS infrastructure with root access, firewall control, snapshots, backups, and room to keep private services off the public internet.

Security checks before opening any Redis port

Redis documentation warns that exposing the Redis TCP port or UNIX socket to untrusted clients is unsafe. A public Redis port can allow destructive operations if the instance is not properly protected.

Before opening or changing the port on a VPS, confirm:

  • Redis binds only to intended interfaces, such as loopback for local-only access;
  • firewall rules allow only the intended clients, using private connectivity where required;
  • application connection strings use the new host and port;
  • protected mode and authentication settings match your deployment;
  • monitoring checks the new port after the change;
  • rollback notes explain how to return to the previous port.

A custom port does not replace those controls. Attackers scan broad port ranges. If Redis is public, moving from 6379 to another number is not enough.

Troubleshooting Redis port problems

Connection refused

The Redis server may not be running on that port, the service may have failed to restart, or the firewall may be blocking the connection. Confirm the configured port and test with redis-cli -p from the same host first.

App still connects to the old port

The application may have a cached environment variable, config file, container secret, or service definition still pointing to 6379. Update the app configuration and restart the app process that reads it.

Redis works locally but not remotely

That is often intentional. Redis should usually be bound to loopback or a private interface. If remote access is required, prefer private networking, firewall allowlists, and authentication rather than a public open port.

A port change did not apply

You may have edited a file that is not used by the running Redis service. Check the service’s actual startup configuration and deployment method. Package installs, containers, and source builds can use different paths.

When should you change the Redis port?

Change the Redis port when you have a clear operational reason: running multiple local Redis instances, avoiding a local service conflict, separating test and production instances, or matching a private-network architecture.

Do not change it just to “hide” Redis. Security comes from binding, firewalling, authentication, protected mode, network design, and least exposure. Port choice is only a routing detail.

FAQ

What is the default Redis port?

The default Redis port is 6379. redis-cli also defaults to 127.0.0.1 and port 6379 unless another host or port is specified.

Can I change Redis to port 6380?

Yes. In a disposable environment, use redis-server --bind 127.0.0.1 --port 6380 to test an unused port with local access only. For a managed production service, change the service configuration and update application connection settings too.

Does changing the Redis port make it secure?

No. A custom port does not secure Redis by itself. Keep Redis off untrusted networks, bind it to intended interfaces, use firewall rules, and configure authentication or protected-mode behavior for your deployment.

Summary

After changing a Redis port, verify the running listener, reconnect the application, and check monitoring. Confirm that intended clients can connect and untrusted clients cannot. Keep the old configuration available for rollback if the new connection fails.

Ready to secure Redis access on Virtarix VPS?

Start with a VPS that gives you root access, firewall control, NVMe storage, IPv4 + IPv6, snapshots, and backups before opening or changing Redis access.

VPS S

For small sites, dev servers and Docker

$ 5 .50 /month
  • 3 cores
  • 6 GB
  • 50 GB NVMe
  • Unlimited
Get It Now
BEST SELLER

VPS M

For growing apps, websites and staging

$ 11 .40 /month
  • 6 cores
  • 16 GB
  • 100 GB NVMe
  • Unlimited
Get It Now
Peter French
About the Author Peter French is the Managing Director at Virtarix, with over 17 years in the tech industry. He has co-founded a cloud storage business, led strategy at a global cloud computing leader, and driven market growth in cybersecurity and data protection.