Apache does not start on port 80 - apache

First, I wanted to see what was using port 80:
C:\Users\[my user]>netstat -aon | findstr :80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
TCP 192.168.1.46:57822 72.21.91.29:80 TIME_WAIT 0
TCP [::]:80 [::]:0 LISTENING 4
C:\Users\[my user]>
See what I had in PID 0 and 4:
I did not have an application using port 80 from what I see. I would think that port 80 is free for an application such as Apache to use it. In the following screen, I click "Start Apache" and nothing happens. That was how I always used to start Apache.
I am trying to start Apache on port 80:
If I use a different port such as 81, 82, 83, etc., it works. But I want to use port 80 because I do not want to use http://localhost:81/ in the URL to test my site. I simply want to use http://localhost/.
Do you have an idea about why I am not being able to start the Apache service on port 80 even though apparently port 80 is free? Or maybe it is not free because this PID 4 is using it? The name of that process is System.

Please try the following;
Right click on My Computer.
Select Manage.
Double click Services and Applications.
Then double click Services.
Right click on "World Wide Web Publishing Service".
Select Stop.

I am using a different port instead of 80. Not a big deal, I would have preferred to use port 80 but I can cope with not using it. That is fine.

Related

How web server handles connections which are same ports & IP Addresses?

I open IE explorer & Chrome in my computer and type localhost:80 and I get the index page.
Here I think my machine's IP is same to both connections (IE explorer & Chrome) and ports are too (80).
Note: Source port will be different (as destination is same: localhost IP), this is my second question.
So how webserver (lets say apache) handles this port 80 connections without failing? Does it port forwarding? In OS level even I tried with addr re-use, port re-use parameters and it is all same we cannot make multiple connection with same IPs & ports.
Now, probably you have came up with a solution: although source ports and IPs are same, destination port is different in package: <protocol>, <src addr>, <src port>, <dest addr>, <dest port>.
A. I got 49483~50004 ports as you can see on image. How client knows which destination port (49483~50004) is bound by webserver? If it is random between 0 and 65355 the webserver always binds all ports, it is very resource consuming. How webservers avoid from this?
Look at this image: command prompt-> netstat
If this question is related with low level sources it is OK, I understand Embedded TCP/IP/UDP, Phy MAC communication and package structures.
You have this all back to front.
All the port numbers at the server are the same: 80. So the client only has to know port 80.
All the port numbers at the client are different: 49483-50004 etc. So there is no ambiguity in the connection, because the 4-tuple you mentioned is unique.
All http request by default call to servers in the port 80, because servers listen by default in that port. So you only give an IP or hostname and the web browser add the default port (80). You can give a custom port if you web server is listenning in another port (usually Tomcat listen by default in 8080) for example you call it in: http://www.youamazingweb.com:8080.
A good example is see the IP as the home and the port is the door where clients enter to consume some resource hosted in server.

How is it that Apache and Firefox can use port 80 (or sometimes port 8080) simultaneously?

The Apache webserver uses port 80 to listen for incoming requests and replies over port 80. Firefox uses port 80 to send requests to webservers and then listens on port 80 for the response from the webserver. I have run Apache and Firefox simultaneously before and am just wondering how two different programs can share the same port.
Each side of a TCP network connection is defined by a touple of (ipaddress, port #). When a packet leaves your system all it knows is that it needs to find ip address 192.168.1.1 and go the whoever has a socket bound to port 80.
A server socket is going to be defined by the address on which Apache is listening and port 80. The client socket open by Firefox will have the same ip address but a different randomly assign port number which you normally do not see.
You can see it using netstat or tcpview (Windows)
For example when I run netstat right now I see:
tcp4 0 0 x.x.x.x.62993 stackoverflow.co.https ESTABLISHED
where x.x.x.x is my laptops ip address and 62993 is the random port number assigned to my web browser.
Firefox isn't listening to port 80. It's making a request to a server port and handling the response.

Which port can be used for apache instead of port 80

Apache is not working on my PC because "NT Kernel & System" is using port 80 of my PC, I tried to stop "NT Kernel & System" from Task Manager but is dosent stop. So I am looking for another port which may solve my problem. I used port 8000, Apache can start from this port but dont work.
If your error message was:" Port 80 in use, "unable to process" with PID 4." And you are using Windows, most likely you have the NT Kernel & System, which is a system process, using port 80. I followed the file location to xampp/apache/conf/https.conf there were 3 places in my file that used the port number which I changed from 80 to 8080 by using the Ctrl+f keyboard shortcut to find any 80 in the file. After I saved the file, I went to my control panel and clicked config, then service and port settings and updated my 80 port to 8080. This started up my Apache server.
The last step was adding ":8080" after localhost in my web address bar.

WAMP - Your port 80 is actually used - Error

I installed Wamp server and when I open it, it never gets online. It always stays orange (offline). I read something about Skype, but I don't even have Skype installed and when I go to Apache > Service > Test port 80 it says: Your port 80 is actually used
Any ideas how to make this work?
I've solved this today!! If you are on Windows, You go to
"Control Panel" >> "System And Security" >> "Administrative Tools" >> "Component Services" >> "Services (LOCAL)"
Now, since you are using WAMP and not IIS you should disable the "World Wide Web Publishing Service" and the "Web Deployment Agent Service". You are good to go.
If this doesn't work you probably have Skype using Port 80 (if you actually have Skype). (If you have IIS installed you should also disable it. But if you don't have it installed you shouldn't worry!)
If you are using windows machine the port 80 is used by the IIS Server and Skype also used the port 80. that why it says that port 80 is already used.
To avoid the conflict,change the port number of the wamp server to some other number,for example 5050.
for changing the port number of the wamp server go to:
C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf
In that file change the listen port to 5050.
#Listen 12.34.56.78:5050
Listen 0.0.0.0:5050
Listen [::0]:5050
and you access the wamp server at localhost:5050
It works for me and I hope it works.
If you are in windows, try:
netstat -b
on Commandline, this will give you an information what file is using port 80, it should look like this:
[httpd.exe]
TCP 0.0.0.0:80 YOUR_PC:0 ABHÖREN
[httpd.exe]
TCP [::1]:80 YOUR_PC:53342 HERGESTELLT
[httpd.exe]
TCP [::1]:80 YOUR_PC:53343 HERGESTELLT
[httpd.exe]
TCP [::1]:80 YOUR_PC:53344 HERGESTELLT

Apache installation on Windows 7

I am a newbie with Apache. I am learning .. after the installation when I tried to start the service I got the following errors.
The Apache service named reported the following error:
Unable to open logs .
The Apache service named reported the following error:
no listening sockets available, shutting down .
The Apache service named reported the following error:
(OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 .
The Apache service named reported the following error:
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.6 for ServerName .
The following error usually means that some other program is listening on the HTTP port (80).
(OS 10048)Only one usage of each
socket address (protocol/network
address/port) is normally permitted. :
make_sock: could not bind to address
0.0.0.0:80 .
In my experience, IM (chat) clients like to connect to port 80.
From a command prompt, (cmd.exe) run the command:
netstat -an
See if there is a listener on port 80 (Look for a line that says:
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
=== ====
the important thing being TCP and 80. If you find something, you'll need to track it down using something like TcpView
If Skype is your problem and it seems it usually is, alter Skype's port usage.
Click on Tools in Skype,
click on Options,
click Advanced,
click Connections.
In Connection is the option to use another port, I use a high numbered port such as 65432, then un-click the alternative use of port 80 and 443.
Close and restart Skype.
modifying C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd sloved the problem.
If you had installation problems, note that you might experience some errors such “ no services installed ”
if Apache is trying to share port 80 with another web server or application, such as a locally installed
firewall application. To fix this, you can tell Apache to use a different port. Open your httpd.conf file
in the conf subdirectory ( C:\Program Files\Apache Software Foundation\Apache2.2\conf by
default) and locate the following lines:
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the < VirtualHost >
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80
Change the last line of this block to read:
Listen 8080
skype uses port 80, try logout and shut down the program...
now run apache
if you are using windows os and believe that skype is not the suspect, then you might want to check the task manager and check the "Show processes from all users" and make sure that there is NO entry for httpd.exe. Otherwise, end its process. That solves my problem.
Changing in the config file every occurrence of the path to apache (eg: "C:/Users/xxxx/Desktop/Apache Software Foundation/") to the new location (in case you shifted directory of apache installation by copy paste) solved my problem. Hope it helps you too..
Please note that, not only http port 80, may your ssl port 443 is being used by any other service or software.
I have installed vmware workstation on my PC, so a process which was initiated by Vmware Workstation was using ssl port 443.
In my case, it was vmware-hostd.exe which was utilizing ssl port 443.
Try shutting down vmware-hostd.exe or simply change your ssl-httpd.conf and modify Listen from 443 to 8080 or something else.
While choosing the port number please be sure that you don't enter any port which can be used by any other software on your PC.
just provide the listen address and port in httpd.conf file. that will not show IP related error as
Listen IP_ADDRESS:PORT
If you change port ( not port 80) then port conflict will not occur and server comes up.
Below blog may help you :-
http://apache2-4-9-webserver-installation.blogspot.com/2014/06/how-to-install-apache-http-server.html
Port 80 conflict. There are a number of well-known Windows programs which use
port 80:
IIS
The most likely culprit is Microsoft Internet Information Server. Stop the
service with the command from the command line on Windows 7/Vista:
net stop was /y
If needed start the services again with the command from the command line on
windows /Vista:
net start was /y