"localhost:8080" works fine but is it mandatory to give the port number always, because it doesn't work when I just type "localhost"
42 Answers
The IANA has assigned 80 as the HTTP well-known port number.
So browsers use this port by default.
If something is listening on a different port, you have to specify the port.
If you want your localhost-listening webserver to accept requests on port 80, you need to configure it to do that.
3if you want localhost to behave like localhost:8080 you have to configure apache to open the both ports. here is how:
- Open apache configuration file. (
httpd.confyou knew that.) - Search for the word
Listenand you will see something like this:
Listen 127.0.0.1:8080
- Add this line after it and save it. then restart apache.
Listen 127.0.0.1:80