Why Apache uses two PIDs and two ports?

8,927

In general Apache has a main privileged process that spawns other less privileged processes as needed that it passes off the requests to for processing. How many depends on the Apache version, the selected process model and configuration settings.

The two default ports apache listens on are HTTP (80) and HTTPS (443) both of which the main process listens on.

Viewing the process tree in a utility like htop highlights the relationship. The default for Centos 7 is show below.

enter image description here

If you checked which PID was listening on the ports for the above system it would be PID 10699.

Share:
8,927

Related videos on Youtube

InfZero
Author by

InfZero

I like computers and Internet.

Updated on September 18, 2022

Comments

  • InfZero
    InfZero over 1 year

    I have a question abut the Apache Web Server running over XAMPP: Why it uses two PIDs and two ports?

    enter image description here

    Thanks in advance for your help!

    • ravi yarlagadda
      ravi yarlagadda over 9 years
      What problem are you trying to solve, why is this a concern for you?
    • Admin
      Admin over 9 years
      About the two ports it's obvious, the first seems to be an HTTP port (derived from the standard 80 port), the second one is the HTTPS port.
    • InfZero
      InfZero over 9 years
      @AndréDaniel, so the PIDs are assigned to manage each port?
    • Admin
      Admin over 9 years
      About the two PIDs it's most likely a control process that listens for connections and then spawns worker processes as the requests arrive, in this case there is only one worker process since the load is very low.
    • Andrew Domaszek
      Andrew Domaszek over 9 years
      There is no correlation between the number of ports and number of processes in use by apache.