Apache

how to configure httpd to listen multiple ports?

Be default, httpd in Red Hat Enterprise Linux 5 listens on http port 80.  In some cases, httpd needs to listen on other http ports besides

In the configuration file /etc/httpd/conf/httpd.conf, the “Listen” directive tells the server to accept incoming requests on the specified port. Multiple “Listen” directives may be used to specify a number of ports to listen to.

Modify the configuration file /etc/httpd/conf/httpd.conf to add multiple “Listen” directives.

For example:


Listen 80
Listen 81
Listen 82

Port numbers 80, 81 and 82, in this example, are the ports that httpd would listen to. To make this change effective, restart the httpd service:


/sbin/service httpd restart

We can verify that httpd is listening on all three ports with the command netstat:


# netstat -anp | grep httpd
tcp        0      0 :::80                       :::*                        LISTEN      5278/httpd
tcp        0      0 :::81                       :::*                        LISTEN      5278/httpd
tcp        0      0 :::82                       :::*                        LISTEN      5278/httpd   
<snip>

If your output is similar to the above, the httpd web server is configured to listen on the specified ports.  If your browser can not connect to these ports, check the firewall settings on the server or intermediate servers between the client and the httpd server.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: