Changing port numbers on existing Virtual Hosts

Andy G

Registered
Feb 5, 2018
2
0
1
Chicago
cPanel Access Level
Website Owner
Good morning everyone.

I would appreciate some help on this problem.

I am trying to get Apache to Listen on port 8080. I have been able to change this via "Tweak Settings" in WHM/Cpanel.

I also need to change all references to the old Port 80 to Port 8080 in existing Virtual Hosts as shown in the excerpt from the httpd.conf file, which I understand should not be modified directly, as shown below:

Code:
<VirtualHost 192.100.200.300:80>
  ServerName example.com
  ServerAlias mail.example.com www.example.com
  DocumentRoot /home/username/public_html
  ServerAdmin [email protected]
  UseCanonicalName Off
  CustomLog /etc/apache2/logs/domlogs/example.com combined
</VirtualHost>

<VirtualHost 192.100.200.300:80>
  ServerName example2.com
  ServerAlias mail.example2.com www.example2.com
  DocumentRoot /home/username/public_html
  ServerAdmin [email protected]
  UseCanonicalName Off
  CustomLog /etc/apache2/logs/domlogs/example2.com combined
</VirtualHost>

<VirtualHost 192.100.200.300:80>
  ServerName example3.com
  ServerAlias mail.example3.com www.example3.com
  DocumentRoot /home/username/public_html
  ServerAdmin [email protected]
  UseCanonicalName Off
  CustomLog /etc/apache2/logs/domlogs/example3.com combined
</VirtualHost>
I understand that Virtual hosts can be modified by creating a new conf file to be included in the following path: " /etc/apache2/conf.d/userdata/ssl/2_4/username/example.com/*.conf" repeated for each domain.

The question is what would be the instruction within the file(s) to effect this change or if this is not the right method, how do I do this.

Some instructions I have come across on the internet suggest making this change in the following file: /etc/apache2/sites-enabled/000-default.conf. However there is no such directory/file on my system.

I would appreciate some help.

I am running a VPS server with Centos 6.9, Apache 2.4.9 and CPanel 66 installed with root access.

Thanks
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello Andy,

You shouldn't need to change the port number in the existing virtual hosts after modifying the port globally via "WHM >> Tweak Settings".

Thank you.