I have the following situation:
I have a local test server where I use Almalinux 8 with CWPanel.
I have several test domains configured on it:
192.168.1.50/~virtual
192.168.1.50/~cliente
192.168.1.50/~sistema.
I would like that when I type in the browser: local.virtual, my computer understands that I typed 192.168.1.50/~virtual. Similarly, if I type local.cliente, it should understand it as 192.168.1.50/~cliente, and so on. I have already configured the “hosts” file to redirect local.* calls to 192.168.1.50, but where do I configure it in CWPanel so that Apache understands where it should direct the requests?
I tried placing the following code in httpd.conf, but it didn’t work:
<VirtualHost *:80>
ServerName local.virtual
DocumentRoot /home/virtual/public_html
<Directory /home/virtual/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName local.cliente
DocumentRoot /home/cliente/public_html
<Directory /home/cliente/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName local.sistema
DocumentRoot /home/sistema/public_html
<Directory /home/sistema/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Unfortunately, I can’t use 192.168.1.50/~virtual for testing because I use friendly URLs in the project and some PHP $SERVER variables that conflict with the “broken” URL with /.
If you can help me, I would appreciate it.