System Administration & Network Administration
linux apache-2.2 ubuntu mod-wsgi ps
Updated Tue, 16 Aug 2022 01:35:23 GMT

Find site of apache from linux process table


I am using Ubuntu server and when I run ps aux I get the following process table http://pastebin.com/NJsASBek as we can see apache proceess are shown like this:

www-data 26487 0.0 0.9 245476 14920 ? Sl 17:32 0:00 /usr/sbin/apache2 -k start

Where 2687 is the PID. How can I know wich of my enabled sites belong that process?

This is how my apache sites are defined http://pastebin.com/mcew79sH of course I am willing to edit my apache sites if needed.




Solution

The default MPM is prefork, which creates (as you've seen) a pre-forked Apache process that is waiting for a connection to serve a request. It does not fire off different processes for different VirtualHost declarations, so any given process could serve any of your sites.

As processes are restarted after a configurable number of requests have been served (or an idle timer passes, and the forks are cleaned up), it's possible that any given process has served pages from multiple VirtualHosts.





Comments (5)

  • +0 – So... how can I know which sites are consuming more memory at a specific moment? — Apr 02, 2012 at 18:42  
  • +2 – Maybe you should change the title/question or start a new one for that since the current question has been answered. — Apr 02, 2012 at 18:53  
  • +0 – I have created a new one serverfault.com/questions/376054/… thanks — Apr 02, 2012 at 20:06  
  • +1 – This answer ignores the fact that they are using mod_wsgi and specifically mod_wsgi daemon mode with the WSGI application delegated to that separate set of processes. More specific answer which deals with that in duplicate question. — Apr 02, 2012 at 21:51  
  • +0 – +1'd on your post. I'm not familiar with WSGI, clearly :-) — Apr 02, 2012 at 22:18  


External Links

External links referenced by this document: