How do I free up tcp port 80 in windows 10?

In summary, this person is trying to set up virtual hosts on their computer, but is having trouble. They have successfully set up Apache, but are having problems with getting their browser to recognize the domain. They have also tried following a tutorial, but it still does not work.
  • #1
shivajikobardan
674
54
Homework Statement
Step by step way to configure name based virtual hosting in apache server
Relevant Equations
None
Studying a totally random subtopic in a subject out of nowhere called virtual hosting. I need to learn to configure its types(port based, name based, ip based).

1654642255745.png

1654642272155.png


1654642302254.png
this kind of answer is what we are expected to write in exam. tbh i didn't find anything like that.

so i am watching this video.


I am getting this error-:
Code:
(OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted.  : AH00072: make_sock: could not bind to address [::]:80 (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted.  : AH00072: make_sock: could not bind to address 0.0.0.0:80 AH00451: no listening sockets available, shutting down AH00015: Unable to open logs

How to reproduce it-:

1) Set up apache server successfully.
2) This is httpd.conf file.

Code:
Listen 80
<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs"
 ServerName www.example.com

# Other directives here
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs"
ServerName www.example.org

I am getting this error. I know the reason is that tcp port 80 is being used by someone else, but I am not sure how to fix this.
 
Physics news on Phys.org
  • #2
I think this problem is fixed but new problem has arose.
The server runs but the websites don't open.
i have created 2 sites-:
example.com
example.org
For each there is an html file. (I haven't linked those html file with domain name tho.
So maybe that's why, when I type example.com in address bar, I am not getting the page that I want actually.
How do I get it? Any way?
 
  • #3
You would need to change your hosts file so that example.com and example.org point to 127.0.0.1, then probably reboot, wait 10 minutes (or naybe 4 hours), say a prayer, make coffee and reboot again.

Seriously, domain name resolution is a whole new topic which is (i) not something you want to mess with on your main computer and (ii) not something you want to do on Windows.

If you want to play with Apache, install a Linux virtual machine. And don't for heavens sake redirect example.com or any other real domain, use "test20220607.test" or something.

But really there is not a lot of point in practicing setting up name based vhosts, I'd just assume it works like it is supposed to.
 
  • #4
pbuk said:
But really there is not a lot of point in practicing setting up name based vhosts, I'd just assume it works like it is supposed to.
This is simply for an exam. We need to write this. Memorizing this is tough. I want to do it in windows 10. Can you help me fix this stuff?
 
  • #5
I don't think you realize that you have already successfully configured Apache to serve files requested from the domains example.com and example.org from the appropriate directories, there is nothing to fix.

If you want to tell your browser that your PC is the correct place to find the example.com server then I have already told you how to do that, but it has nothing to do with setting up the virtual host and IMHO will only confuse you even more.
 
  • #6
pbuk said:
I don't think you realize that you have already successfully configured Apache to serve files requested from the domains example.com and example.org from the appropriate directories, there is nothing to fix.

If you want to tell your browser that your PC is the correct place to find the example.com server then I have already told you how to do that, but it has nothing to do with setting up the virtual host and IMHO will only confuse you even more.
can i do this stuffs in windows? it is pretty annoying to me. i am not getting any direction. i have indeed set up apache server. but that's half a story. now i need to do name based and ip based virtual hosting. can you provide any suggestions that require me minimal time to learn but give the best experience. i am pretty frustrated with this. as i said, i have done everything mentioned in tutorials. but when i try to open a site example.com my html document file doesn't comes up. it is annoying at its best.
 
  • #7
I will only say this once more, getting your browser to look for example.com on your local server has nothing to do with setting up a name based virtual host for example.com.

If you want your browser to to look for example.com on your local server you have to edit your hosts file. Look it up.
 
  • #8
pbuk said:
I will only say this once more, getting your browser to look for example.com on your local server has nothing to do with setting up a name based virtual host for example.com.

If you want your browser to to look for example.com on your local server you have to edit your hosts file. Look it up.
I have already edited hosts file

IP address(that i got from ipconfig) www.test1nepali.net
IP address www.test2nepali.net

And rebooted. Still didn't work.
I again tried and followed this-:https://fedingo.com/how-to-setup-apache-virtual-host-in-windows/

and it still doesn't work.
 
Last edited:
  • #9
pbuk said:
IMHO will only confuse you even more.
I was right :frown: ipconfig won't tell you anything useful here (except your LAN IP address which will come in handy when you get round to trying IP based virtual hosting).

shivajikobardan said:
I have already edited hosts file
Open a command prompt and type
Bash:
ping www.test1nepali.net
You should get output exactly the same as this:
Code:
Pinging www.test1nepali.net [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
Copy a screenshot here to confirm this. If you don't get this then you have not successfully edited your hosts file (actually I was lying about the reboot, edits to the hosts file are live immediately). In your command prompt type
Bash:
copy C:\Windows\System32\Drivers\etc\hosts con
# Or in Powershell
ls C:\Windows\System32\Drivers\etc\hosts
You should have the entry
Code:
127.0.0.1 www.test1nepali.net www.test2nepali.net
in there. Copy a screenshot here to confirm this.
 
  • #10
  • #11
pbuk said:
@shivajikobardan how did it go?
i think i am skipping this. they say to install centos. doesn't look like there is a way to do this on windows os. everything is extremely confusing.
https://systemzone.net/virtual-web-hosting-with-apache-on-centos-7-name-based/

I am looking at here. I think our curriculum expects us to do this on centos-:
Lab 7: Web & DNS Server Installation, Configuration and Hosting.
https://systemzone.net/virtual-web-hosting-with-apache-on-centos-7-name-based/
but this will be extremely time consuming will take like 1 day for me to do-fix-do-fix-do etc. I would just do the theoritical part of it.

Code:
[root@webserver conf]# vim httpd.conf
 

<VirtualHost 192.168.40.101>

DocumentRoot /var/www/html/systemzone.net

ServerName systemzone.net

ServerAlias www.systemzone.net

</VirtualHost>

<VirtualHost 192.168.40.101>

DocumentRoot /var/www/html/systemzone.com

ServerName systemzone.com

ServerAlias www.systemzone.com

</VirtualHost>

<VirtualHost 192.168.40.101>

DocumentRoot /var/www/html/systemzone.org

ServerName systemzone.org

ServerAlias www.systemzone.org

</VirtualHost>

Just this and hope for the best haha. If this comes up for 4 marks, this would be enough(total subject is of 80 marks).
 

FAQ: How do I free up tcp port 80 in windows 10?

How do I check if port 80 is already in use on my Windows 10 computer?

To check if port 80 is already in use on your Windows 10 computer, you can use the command prompt and type in "netstat -aon | findstr :80". This will show you a list of all the processes that are currently using port 80.

How do I free up port 80 if it is already in use?

If you find that port 80 is already in use, you can free it up by terminating the process that is using it. You can do this by going to the Task Manager, selecting the process that is using port 80, and clicking on "End Task". This will free up the port for other processes to use.

Can I change the default port 80 to a different port?

Yes, you can change the default port 80 to a different port. To do this, you will need to edit the configuration file of the program or service that is using port 80 and change the port number to a different one. Keep in mind that the new port should not be in use by any other process.

Why is port 80 commonly used for web traffic?

Port 80 is commonly used for web traffic because it is the default port for HTTP (Hypertext Transfer Protocol), which is the protocol used for transmitting data over the internet. Most web browsers and servers are configured to use port 80 for HTTP requests and responses.

Is it safe to free up port 80 on my Windows 10 computer?

It is generally safe to free up port 80 on your Windows 10 computer, as long as you are not terminating a critical system process. However, keep in mind that if you change the default port for a program or service, it may cause compatibility issues with other programs or services that are configured to use port 80.

Back
Top