'Apache error - localhost:150 - Not a Listen port

I'm setting up a web server, but I'm new in this kind of stuff. And I kinda set it up, but I get the following problem when i enter my localhost page:

  • localhost:150 - Not a Listen port
    Error(s) See below
    Port :150 used for the VirtualHost is not an Apache define variable

Also, when I press localhost on my WAMP, it doesn't work, but when I enter localhost:150 to google, it works.

I have tried changing ports to 150 in httpd.conf and httpd-vhosts.conf .

I want to run my localhost without this error. All help is appreciated.



Solution 1:[1]

An easier way to do it is to open httpd.conf and add under the Listen section:

Listen 0.0.0.0:80
Listen [::0]:80
Listen 0.0.0.0:YOUR_PORT
Listen [::0]:YOUR_PORT

And restart the server

Solution 2:[2]

This is a bit of a late response, but I hope it helps someone. I've had the same issue and resolved it by finding the wampserver file in c:\ (you may have downloaded it to a different directory) and edited the 'add_vhost' file. I found it in c:\wamp/www/

Inside of the add_vhost file, you need to find every instance of the number 80 and ONLY edit the instances that pertain to Port 80 (I assume that you were having an issue with port 80 and that's why you've changed your port). There should only be two if-statements in which it occurs: [e.g., if($vh_port == '80' || $vh_port == $c_UsedPort) ]. In my case, I swapped out '80' for desired port '8081'.

You will also need to check your httpd-vhosts.conf file (in Apache on wamp server) and confirm that your document root and directory are pointing to the correct path. Hint: it should be the same path where you found your add_vhost file. E.g., DocumentRoot "c:\wamp64/www"

Lastly, you should right click the green wamp server icon and select tools, then select 'use a port other than 80' and change it to 150.

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 Elikill58
Solution 2 lyndipc