Add a custom vhost to cPanel server?

Sakthybaalan

Registered
Jul 9, 2019
4
0
1
SriLanka
cPanel Access Level
Root Administrator
I want to run the Laravel API with a specified port 5000. Because there is another websocket also running on port 8090.

I have done this regular way on Ubuntu 18.04 server with the following vhosts

/etc/apache2/sites-available/206.189.xxx.xxx.conf

Code:
<VirtualHost *:5000>
       ServerName 206.189.xxx.xxx
       ServerAdmin [email protected]
       DocumentRoot /var/www/myapi/public

       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined

       <Directory /var/www/myapi>
               AllowOverride All
       </Directory>

</VirtualHost>
/etc/hosts

Code:
    127.0.0.1 206.189.xxx.xxx
/etc/ports.conf

Code:
    Listen 5000  #Newly added

How can I add these configurations to WHM and cPanel?
 
Last edited by a moderator:

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,749
2,205
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @Sakthybaalan,

You can find information about how to modify your Apache virtual host containers with include files on our Modify Apache Virtual Hosts with Include Files documentation.

Additionally, while it's specific to Tomcat instead of Laravel, you may find the information in this post helpful.

Let me know if you have any questions about how to setup the include files.

Thank you.
 

Sakthybaalan

Registered
Jul 9, 2019
4
0
1
SriLanka
cPanel Access Level
Root Administrator
Thank you cPanelMichael

I read the article of tomcat but It is very difficult to understand , so please help to modify as my request in the safe manner which will not affect the current running websites.
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,749
2,205
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @Sakthybaalan,

Could you share a link to the README (or installation instructions) that you are following? I'm happy to perform a setup on a test server and provide you with the information you need to ensure it functions with cPanel & WHM.

Thanks!
 

Sakthybaalan

Registered
Jul 9, 2019
4
0
1
SriLanka
cPanel Access Level
Root Administrator
Last edited by a moderator:

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,749
2,205
363
cPanel Access Level
DataCenter Provider
Twitter
Hello @Sakthybaalan,

The following script will allow you to assign one or more ports to a specific user:


Additionally, we recently published a resource that you may find a little more helpful (specifically the ProxyPass section)


Let me know if this helps.

Thank you.