How to access CyberPanel without using port 8090?

If you are using CyberPanel, you may have noticed that the administration interface is accessible via port 8090 by default. In some cases, it may be desirable to hide or remove port 8090 for security reasons or to simplify access to your control panel. In this article we will see how to remove or access CyberPanel without using port 8090.

Step 1: Create a website for the hostname

First of all, you need to decide which domain you want to access CyberPanel on without adding the port.

In this example we will use https://admin.dir-tech.com.

Then create a website for this domain (hostname). Make sure that the A record of this domain already points to your server.

Go to INTERNET SITES then create a site.

How to access CyberPanel without using port 8090?

Step 2: Issue an SSL certificate for the host name

It is now necessary to issue an SSL certificate for the previously chosen domain. In our example, it is https://admin.dir-tech.com.

How to access CyberPanel without using port 8090?

Step 3: Configure CyberPanel without port 8090

Make sure you have opened an SSH connection to your server.

We will use the following commands.

Open the command line and modify: /usr/local/lsws/conf/httpd_config.conf

nano /usr/local/lsws/conf/httpd_config.conf

Paste the following content:

extprocessor cyberpanel {
  type                    proxy
  address                 https://admin.dir-tech.com:8090
  maxConns                100
  pcKeepAliveTimeout      60
  initTimeout             60
  retryTimeout            0
  respBuffer              0
}

Remember to change the URL in the following code snippet to match your chosen CyberPanel administrator domain. However, keep the port 8090 in this extract!

Add a rewrite rule to your website as follows:

In your CyberPanel user interface, go to Websites and then List of Websites
To the right of the panel with your domain, click on Manage.

At the bottom of the list, you will find an option “Rewrite rules”, click on it.

How to access CyberPanel without using port 8090?

You can now use rewrite rules to direct traffic to port 8090.

You can use these rules:

### Rewrite Rules Added by CyberPanel Rewrite Rule Generator

RewriteEngine On
RewriteCond %{HTTPS}  !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^(.*)$ HTTP://cyberpanel/$1 [P]

### End CyberPanel Generated Rules.

To better understand the rewrite rules, consult the CyberPanel documentation.

Congratulations! You should now be able to visit CyberPanel with the domain you created in Step 1.

Step 4 (Optional): Block CyberPanel port 8090

Since you no longer use port 8090, you can block it for security reasons.

To do this, on the CyberPanel dashboard, click on SECURITY then FIREWALL. Then you can block the ports by deleting them.

How to access CyberPanel without using port 8090?

Conclusion

By following these steps, you can remove port 8090 from CyberPanel and simplify access to your administration interface. This method also increases the security of your server by restricting access to the control panel via a reverse proxy and by blocking direct access to port 8090.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.