webdnstools.com
DNS Lookup, Reverse DNS Lookup, Domain Configuration Check and IP Address Calculators

Bind Apache to an IP Address for HTTPS

If you have a Linux server managed by Plesk that has multiple IP addresses, Plesk automatically configures all IP addresses to be used by Apache on port 80 and port 443. If you want to use port 443 on a specific IP address for something else (like SSH) you'll first need to reconfigure Apache so that it doesn't listen on port 443 for that IP address.

To do this you'll need to modify the ssl.conf file in the following directory:

/etc/httpd/conf.d/ssl.conf

Search for the Listen statement. You'll probably find that it only specifies a port number. This means that it listens on all IP addresses on this port. We need to change this so that it binds to a specific IP address (or IP addresses).

On my server, the original Listen statement in the ssl.conf file looked like this:

#
# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#
Listen 443

I wanted to bind Apache to one IP address on port 443, so I added my IP address to the Listen statement, like this:

#
# When we also provide SSL we have to listen to the
# standard HTTP port (see above) and to the HTTPS port
#
Listen 192.0.2.45:443

Now restart the Apache HTTP server. It should now be listening on only one IP address on port 443. You can run the following command to verify this:

netstat -lntpe | grep ":443"

You should now see something like:

tcp   0   0 192.0.2.45:443   0.0.0.0:*   LISTEN   0   1035375   24332/httpd

This means that the Apache server is listening on port 443 on the one IP address.