Re: File permissions for a wiki-like site



Jerry Stuckle wrote:
The Natural Philosopher wrote:
Jerry Stuckle wrote:
The Natural Philosopher wrote:
Jerry Stuckle wrote:

You cannot, for example, have multiple instances of Apache listening on
port 80 of a single IP address, and I thought assigning 255 IP addresses
to a single web server went out with browsers that don't understand
HTTP/1.1 and the Host: header.


I didn't say anything about multiple instances on port 80, did I?


Actually you can, and often do, have multiple instances of Apache (effectively) listening on port 80..

That's how virtual hosting and load balancing works.

No. You can only have one instance of Apache running on port 80 on a single machine.

Virtual hosting works because that one instance has several hosts defined. But it is still only one instance.

Load balancing works because the instances of Apache are on different systems.


Semantics.


No, much more than semantics. If you have multiple instances of Apache running on different ports, those processes can have different owners. A single instance of Apache only has one owner.

You can chain more listeners than one to a single port. At what point that becomes 'more than one instance tied to a port' as against 'one OS routine vectoring calls to multiple processes' is a moot one.

My process list for apache shows this:-

ps -eadf| grep apache
root 9310 1 0 Jul16 ? 00:00:00 /usr/sbin/apache
www-data 22302 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 22303 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 22304 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 22305 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 22306 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 22807 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 22892 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 23339 9310 0 Sep16 ? 00:00:00 /usr/sbin/apache
www-data 23417 9310 0 Sep17 ? 00:00:00 /usr/sbin/apache
www-data 23418 9310 0 Sep17 ? 00:00:00 /usr/sbin/apache

i.e 10 instances of apache on ONE server instance are running. Plus the original spawner. This is on an IDLE web server..the spare processes are there to add load capacity without the overhead of a fork().


Sure. They are different processes.

It is perfectly possible for more than one process to bind() to the same socket, provided that the socket options are set up that way. The only proviso being that the processes understand each other and work co-operatively. In essence its no more complex than e.g sharing a hardaware interrupt: All processes that are attached to that interrupt wake up, and one of them decides 'its mine' and takes it whilst the others go back to sleep..



I am fairly sure apache does this routinely as above:


Or does the main process get the request and hand it off to the appropriate process? This would seem to be much lower overhead. I'm not sure about it.


Yes and no. The main process is, I think, the operating system.I.e. the ten processes register themselves as waiting for a SYN packet on port 80..the OS notes that, and when one arrives simply resumes all of them. The first one to get there accepts the connection and the rest wake up, find nothing to do and go back to sleep probably.

.



Relevant Pages

  • Re: Apache Running... But the port isnt open.
    ... verify that it is listening on 0.0.0.0:* with ipv4. ... Subject: Apache Running... ... But the port isn't open. ... > localhost' pulls up the page, ...
    (freebsd-questions)
  • Re: File permissions for a wiki-like site
    ... to a single web server went out with browsers that don't understand ... Actually you can, and often do, have multiple instances of Apache listening on port 80.. ... Load balancing works because the instances of Apache are on different systems. ...
    (comp.lang.php)
  • Re: The connection was refused when attempting to contact the localhost
    ... > Do apache logs give any clue of attempting connection when it is set to ... > Listen 8080 and someone attempts to connect to your URL with that port? ... be listening to any particular site like some other ports seemed to be ... I tried to reboot my computer without the router and it ...
    (comp.os.linux.networking)
  • Hacker problem...Takes down apache?
    ... It seems to be doing *something* to break Apache in an attempt ... When connecting to port 80 on the web server with a web browser a "page ... However sockstat still shows httpd listening on port ...
    (freebsd-questions)
  • Re: File permissions for a wiki-like site
    ... to a single web server went out with browsers that don't understand ... Actually you can, and often do, have multiple instances of Apache listening on port 80.. ...
    (comp.lang.php)