'Wampserver - The ServerName localhost:7979 is not defined into hosts file

WampServer Virtual Hosts

Here's the config file - C:\wamp64\bin\apache\apache2.4.51\conf\extra\httpd-vhosts.conf

# Virtual Hosts
#
'''
<VirtualHost *:7979>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

Host's file - C:\Windows\System32\drivers\etc

127.0.0.1 localhost
::1 localhost

I can access my project's fine, it's just on the homepage it's bringing this error.



Solution 1:[1]

Windows Hosts File

Looks like the port number had to been included like the image above on the hosts file, no error messages now.

Solution 2:[2]

at your Host's file - C:\Windows\System32\drivers\etc, you can add or edit your first line:

127.0.0.1 localhost:7979

Solution 3:[3]

There is a process for adding port numbers to WAMPServer.

Using the wampmanager.exe icon in the system tray do the following

Right click wampmanager icon -> Tools -> Add a Listen port to Apache

enter image description here

This will throw a little dialog onto the screen, enter the port number you want to use, and that will be added to the httpd.conf file like this

Define MYPORT8082 8082

Into this section of the httpd.conf file

Like this

Define APACHE24 Apache2.4
Define VERSION_APACHE 2.4.52
Define INSTALL_DIR c:/wamp64
Define APACHE_DIR ${INSTALL_DIR}/bin/apache/apache${VERSION_APACHE}
Define MYPORT8082 8082
Define SRVROOT ${INSTALL_DIR}/bin/apache/apache${VERSION_APACHE}

If you add your port number like that, then change the httpd-vhosts.conf file to use the define on the VirtualHosts definition

<VirtualHost *:${MYPORT8082}>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Moti
Solution 2 Mohamed Yassine Hemrit
Solution 3 RiggsFolly