Address already in use: make_sock: could not bind to port 80/443

This error occurs for one of two reasons. Either you are not root or another application is already using the port(s) Apache wants to use. If you are not root and do not have administrative access to the machine, you must change the Apache configuration to use another port as described below.

 

HTTP normally binds to port 80; HTTPS normally binds to port 443. Similar errors can occur if port 443 is already in use when Apache with HTTPS is trying to start.

 

To find out which, if any, application is already using the port(s) in question run netstat -tlnp | egrep ":80 |:443 " as root. If the command returns no output then no applications are using either port 80 or 443, which means Apache should have a no problem binding to the port(s) it needs.

 

However, if output is returned, look to the far right of each row of output for the PID and name of the executable. This will give you an indication of what process is currently using the port. The quick and dirty solution is to run kill , where is the PID of the process(es) using the ports needed by Apache. A more elegant solution would be to find out how the application currently using the port got started and prevent it from starting.

 

If ports 80 and/or 443 are in use or you do not have root access, another solution is to change which port(s) Apache uses. This will produce a non-standard configuration, but will circumvent the issue where ports 80 and 443 are already in use. Doing so requires the modification of the file /etc/httpd/conf/httpd.conf . The LISTEN directive specifies which port (80, by default) on which Apache will listen for HTTP requests. Similarly, the file /etc/httpd/conf.d/ssl.conf also has a LISTEN directive which specifies the port (443, by default) on which Apache will listen for HTTPS requests. Using your favorite text editor, change the value to an unused port number and [re]start the Apache service.

 

For example, in /etc/httpd/conf/httpd.conf , change the line


Listen 0.0.0.0:80

to

Listen 0.0.0.0:XXXX
 

where XXXX is an unused port. Then [re]start Apache/HTTPD by typing either

service httpd restart
 

or

apachectl restart

 

If Apache was not previously running you can safely ignore any errors indicating that HTTPD could not be stopped. Note that if you add 443 to the list of available addresses in the main tab of the Apache configuration tool system-config-httpd (redhat-config-httpd) in Red hat Enterprise Linux 3 and below) and enable SSL you might get errors since the SSL directive conflicts with this port.

你可能感兴趣的:(apache,ssl,application,Access,binding,output)