• Support
  • How to Block Direct IP Access to aaPanel and Allow Access Only via Domain?

Hello,

I'm using aaPanel on a VPS with Apache as my web server. My aaPanel is currently accessible through both the domain and the IP address. However, I want to block all direct access via the server's IP (including any port), so that the panel can only be accessed via my domain, which is routed through Cloudflare.

The domain configuration is working fine, and it points to the server using the following setup:

Domain: painel.saralapia.site
IP: 132.226.253.4
Port: 7800
Right now, when I try to access https://Vps_IP:7800, the aaPanel login page is displayed. I want to prevent access via IP and allow access only through the domain (https://painel.mydomain.com:7800).

I've tried configuring Apache with VirtualHosts to block IP access, but the login page is still accessible via the IP. Can anyone guide me on how to block all direct IP access and ensure the panel is only accessible through the domain?

Thank you in advance!

    Hello, it is recommended that you bind the domain name directly in the settings. After binding the domain name, you can only use the domain name to access the panel. Cancel domain name command bt 12
    It is not recommended that you use the apache proxy aapanel,
    You can access aapanel directly through Cloudflare. Note that you need to use Cloudflare's trusted port such as 2087.

    aaP_rodrigo-rios

      aaPanel_Kern

      Thank you for the response! Just to clarify, I currently have an A record in Cloudflare pointing painel.mydomain.com to the IP of my VPS. Could you explain how I should configure this setup with Cloudflare and aaPanel? Should I change anything in Cloudflare or on the server (VPS) to ensure access to the panel is only through the domain, especially when using a trusted port like 2087?

      Thanks again for your help!

        aapanel needs to bind a domain name to prohibit IP access. When using Cloudflare, you must use the corresponding port, and keep the others as default.

        aaP_rodrigo-rios