Can’t get HTTPD to start due to server port configuration issue

My httpd.conf shows it's listening on port 80. I think I am supposed to change the IP to IP of my machine, but I am not sure and wisely hesitant.

#Listen 12.34.56.78:80
Listen 80

However my virtual hosting is showing a port 443, how do I change this? Is this the root of my problem?

Update

'VirtualHost default:443' = /etc/httpd/conf.d/ssl.conf

This tells me Virtual Hosting is correct. I feel like I can eliminate all information that relates to 443 from this scenario to get to the answer.

/etc/httpd/conf.d/ssl.conf:<VirtualHost _default_:443>
/etc/httpd/conf.d/ssl.conf:#ServerName
/etc/httpd/conf.d/ssl.conf.rpmnew:Listen 443 https
/etc/httpd/conf.d/ssl.conf.rpmnew:<VirtualHost _default_:443>
/etc/httpd/conf.d/ssl.conf.rpmnew:#ServerName 

which is

Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xe" for details.

I am trying to learn from a similar thread. I'm on Fedora so its a bit different for me to understand.

systemctl status httpd.service says:

httpd[1182]: AH00526: Syntax error on line 18 of /etc/httpd/conf.d/ssl.conf:

Line 18 says | Listen 80

httpd[1182]: Cannot define multiple Listeners on the same IP:port
systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: httpd.service: Failed with result 'exit-code'.
systemd[1]: Failed to start The Apache HTTP Server.

line 18 of /etc/httpd/conf.d.ssl.conf | Listen 80

This is where I get confused because grep '443' /etc/httpd/conf.d/*shows my ssl.conf file as 443 but when I reading the httpd.conf file I see here the 12.34.56.78:80 is a preventative IP. Therefore I should add my machines IP here and to listen on 80 and 443.

1

1 Answer

The error seems to indicate you may have multiple Listen directives in your Apache configuration file(s) specifying the same IP/port 80 combination.

Listen (as a general rule) should only appear once in httpd.conf (e.g. as Listen 80) and once in your default SSL configuration (e.g. as Listen 443).

And while it is possible to have multiple Listen directives on the same port (e.g. 80), they all must have different IP:port combinations.

Therefore I should add my machine's IP here and Listen on 80 and 443.

Apache Listen directives can take two general forms: "Per IP" and "Global" (all available IPs):

# Per IP
# Listen 12.34.56.78:80
# Global (i.e includes ex. 12.34.56.78)
Listen 80

The configuration above works. Something like the following will generally work as well (assuming your system has mutiple IPs):

# Per IP
Listen 12.34.56.78:80
Listen 23.56.78.90:80
# Global (i.e includes ex. 12.34.56.78)
# Listen 80

This will likely not work (i.e. Apache will fail to start):

# Per IP
Listen 12.34.56.78:80
# Global (i.e includes ex. 12.34.56.78)
Listen 80

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like