I am trying to enable mod-nss module in Apache2. So after doing what is necessary, I am trying to validate that indeed the module is loaded.
Asking apachectl
# apachectl -M | grep nss
nss_module (shared)
Asking the daemon itself:
/usr/sbin/httpd-prefork -M | grep nss
-> No output
So, I get two different outputs:
- apachectl claims that the mod_nss module is loaded.
- httpd claims that the mod_nss module is not loaded.
After this, I decided to list the modules for both (instead of just grep-ing for a specific one), sort the output and then compare them.
# diff -Nur httpd_sorted_modules apachectl_sorted_modules
--- httpd_sorted_modules 2016-09-01 13:59:16.297139860 +0200
+++ apachectl_sorted_modules 2016-09-01 13:59:26.680985223 +0200
@@ -15,11 +15,15 @@
expires_module (shared)
http_module (static)
include_module (shared)
+ info_module (shared)
log_config_module (shared)
mime_module (shared)
mpm_prefork_module (static)
negotiation_module (shared)
+ nss_module (shared)
+ php5_module (shared)
reqtimeout_module (shared)
+ rewrite_module (shared)
setenvif_module (shared)
so_module (static)
socache_shmcb_module (shared)
As you can see, apachectl shows 4 extra modules in contrast to httpd. Why is that happening? And which one should I put my trust on?
I tried to see what's the difference between those, but I failed. Here's some of my findings:
apachectl seems to be a standalone binary
# ls -l `which apachectl`
-rwxr-xr-x 1 root root 3548 Aug 23 13:11 /usr/sbin/apachectl
that comes from apache pkg:
# rpm -qf `which apachectl`
apache2-2.4.16-12.1.x86_64
which is actually used to ease the control around httpd. Apparently, there is difference in using it with SystemD or SySVinit. Here's a quote from the man apachectl page:
When acting in pass-through mode, apachectl can take all the arguments available for the httpd binary.
apachectl [ httpd-argument ]When acting in SysV init mode, apachectl takes simple, one-word commands, defined below.
apachectl command
So, if I request for the -h help option:
# apachectl -h
Usage: /usr/sbin/httpd-prefork [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
So it seems that it's using the /usr/sbin/httpd-prefork or at least that what it says.
But let's try to see what 'httpd' is using in the background:
# which httpd
/usr/sbin/httpd
which seems to be a symlink:
# ls -l `which httpd`
lrwxrwxrwx 1 root root 23 Aug 25 13:28 /usr/sbin/httpd -> /usr/sbin/httpd-prefork
so it uses the /usr/sbin/httpd-prefork which is the same one with what apachectl seems to use. For example if I request for -h help, I get:
# /usr/sbin/httpd-prefork -h
Usage: /usr/sbin/httpd-prefork [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in <IfDefine name> directives
-d directory : specify an alternate initial ServerRoot
-f file : specify an alternate ServerConfigFile
-C "directive" : process directive before reading config files
-c "directive" : process directive after reading config files
-e level : show startup errors of level (see LogLevel)
-E file : log startup errors to file
-v : show version number
-V : show compile settings
-h : list available command line options (this page)
-l : list compiled in modules
-L : list available configuration directives
-t -D DUMP_VHOSTS : show parsed vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
which is identical to what I get with apachectl -h.
However, this one comes from another package:
# rpm -qf /usr/sbin/httpd-prefork
apache2-prefork-2.4.16-12.1.x86_64
Apart from that, I cannot think of a reason why I get different output when I query for the loaded modules :/
For those who would like to know, I am using OpenSUSE Leap 42.1 as my Linux distribution, and I run Apache with Prefork MPM.