Forward IP to Domain in CyberPanel

Every VPS and a dedicated server comes with a dedicated IP address. For example, 192.168.1.1. When you put this IP address directly in the address bar in CyberPanel, it returns to the error page. You can point your server main IP or any other IP to the main domain or any other domain hosted on your server.

Forward IP to Domain in CyberPanel

In this post, we will forward IP to a domain name using CyberPanel using root level. For this, you need to open your SSH terminal using your root credentials.

Perform the following operations carefully and this setting only works for OpenLiteSpeed.

After logging into root, type the following command:

 cat /usr/local/lsws/conf/httpd_config.conf

To edit the httpd_config.conf file, you need to type:

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

After you open it, find this line:

listener Default {

As part of this directive, type the following line before or after the following line “}” symbol.

map Example *

Now save this file by typing ctrl+X and Y on your PC or computer keyboard.

After that you need to edit Example/vhost.conf file. To edit this, type the following command.

nano /usr/local/lsws/conf/vhosts/Example/vhconf.conf

This file has a rewrite option by default. Find the code below to delete it:

rewrite  {
  enable                  1
  logLevel                9
}

Delete or cut this entire code using the Backspace button on your PC keyboard.

Now scroll the file to the very end and paste the below command into this file.

rewrite  {
  enable                  1
  logLevel                9
RewriteCond %{HTTP_USER_AGENT}  ^NameOfBadRobot
RewriteRule ^/nospider/         -   [F]

RewriteRule ^/$ http://insidehost.net/? [L,R=301]
}

In the code above replace insidehost.net with your domain name.

Forwarding IP to Domain in Cyber ​​Panel

Save this file.

Now restart your LiteSpeed ​​server by typing the following command.

/usr/local/lsws/bin/lswsctrl restart

Or reload the config

/usr/local/lsws/bin/lswsctrl reload

Now type your server IP in the Google address bar and hit enter. It will redirect to the domain name.

you did!

explanation

When you buy through affiliate links on our site, we may earn an affiliate commission at no cost to you.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *