DEV Community

Carrie
Carrie

Posted on

1 1 1 1 1

How to Solve "Port Already in Use" Error When Configuring an APP in SafeLine?

SafeLine is a WAF powered by a semantic analysis engine, unlike traditional signature-based solutions. It's self-hosted and very easy to deploy & configure.

Github: https://github.com/chaitin/SafeLine
Website: https://safepoint.cloud/landing/safeline

Error Message

When configuring an application in SafeLine WAF, you may encounter a port conflict issue, such as:

"listen tcp :80: bind: address already in use"

This error indicates that the configured port is already occupied by another program instead of SafeLine.

Image description

How to Solve It

1. Check Port Usage

Use the following command to determine which program is occupying the port:

ss -antp | grep LISTEN | grep <port_number>

Alternatively, you can check the process management function in your control panel to identify the specific program using the port.

2. Modify the Config of the Program Using the Port

  • If it is a control panel service (e.g., OpenResty in 1Panel):
    Locate its configuration file, such as: /opt/1panel/apps/openresty/openresty/conf/conf.d/default.conf
    Change the port number in the listen directive (e.g., from 80 or 443 to 10080 or 10443).

  • Save the changes and restart the service.

  • If it is Nginx service, go to the site configuration settings, modify the listening port, and reload the configuration.

  • Ensure that the previously occupied port is now free before reconfiguring the site to listen on that port.

3. Check Firewall or Security Group Rules

If the issue persists after modifying the port, verify whether the new port is open for access. Ensure that firewall rules and security group settings allow traffic on the newly assigned port.

Top comments (0)