Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing port numbers on existing Virtual Hosts

Discussion in 'EasyApache' started by Andy G, Feb 5, 2018.

  1. Andy G

    Andy G Registered

    Joined:
    Feb 5, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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 webmaster@example.com
      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 webmaster@example2.com
      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 webmaster@example3.com
      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
     
  2. Andy G

    Andy G Registered

    Joined:
    Feb 5, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago
    cPanel Access Level:
    Website Owner
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,502
    Likes Received:
    1,616
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page