LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache (https://www.linuxquestions.org/questions/linux-newbie-8/apache-333707/)

IwantLINUX 06-15-2005 12:43 AM

Apache
 
Hi all,

can somebody let me know the use of the LISTEN directive in httpd.conf. It has been mentioned that "The Listen directive tells the server to accept incoming requests on the specified port or address-and-port combination." and it specify particular IP addresses over which the server will accept connections. But what does that actually means and what is its use?

Pls hlp...

Boby 06-15-2005 03:04 AM

Hello!

Quote:

The Listen directive instructs Apache to listen to only specific IP addresses or ports; by default it responds to requests on all IP interfaces. Listen is now a required directive. If it is not in the config file, the server will fail to start. This is a change from previous versions of Apache.

The Listen directive tells the server to accept incoming requests on the specified port or address-and-port combination. If only a port number is specified, the server listens to the given port on all interfaces. If an IP address is given as well as a port, the server will listen on the given port and interface.

Multiple Listen directives may be used to specify a number of addresses and ports to listen to. The server will respond to requests from any of the listed addresses and ports.

For example, to make the server accept connections on both port 80 and port 8000, use:

Listen 80
Listen 8000

To make the server accept connections on two specified interfaces and port numbers, use

Listen 192.170.2.1:80
Listen 192.170.2.5:8000

IPv6 addresses must be surrounded in square brackets, as in the following example:

Listen [fe80::a00:20ff:fea7:ccea]:80

Error condition
Multiple Listen directives for the same ip address and port will result in an Address already in use error message.
http://httpd.apache.org/docs-2.0/mod/mpm_common.html

Hope you understand :)
Boby

IwantLINUX 06-16-2005 08:21 AM

Hi Boby,
I do understand this, but what i want to know is its exact usage. I mean what effect does it makes when my machine is having multiple IPs and what is the use of making Apache listen over just one IP address...

I am really sorry for being dumb....

tuxrules 06-16-2005 11:03 AM

AFAIK, you can setup Virtual hosting (i.e. host more that one website) either with one IP address or specify a seperate IP address to each virtual host you have on your machine.

Quote:

what is the use of making Apache listen over just one IP address...
I believe its used when you have a static IP address. Whereas, if you have a dynamic IP address, you would just want apache to listen to a port so that you dont have to go and change apache config file everytime your IP address changes.

I hope you understand...for more info you can read the apache config file (httpd.conf) file which has detailed explanation.

Tux,

IwantLINUX 06-17-2005 05:48 AM

Hello tuxrules,

Thank you for your valuable reply. I have gone through httpd.conf but comments didn't solve my concern. I mean what benefits we are getting by making Apache listen over one IP?

lookin forward for a reply...


All times are GMT -5. The time now is 02:25 PM.