Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How can I check what modules have been added to an nginx installation?

share|improve this question
4  
Another way of saying this is "how can I see which flags Nginx was compiled with?" Just wanted to add that to increase searchability. –  Nathan Long Feb 20 '12 at 17:37

2 Answers 2

nginx -V will list all the configured modules. There is no explicit enable/load command.

share|improve this answer
    
thanks very much –  Nisanio Jan 18 '11 at 11:37
    
It was helpfull indeed. –  Saif Bechan Dec 5 '11 at 17:35
3  
Note for noobs: If not logged in as root user, the command would be sudo nginx -V –  its_me Feb 8 '13 at 4:08

Diff-able one-liner:

2>&1 nginx -V | tr -- - '\n' | grep _module

Convenient for comparing two environments:

lsmodn="2>&1 nginx -V | tr -- - '\n' | grep _module"
diff -y <(ssh www-prd eval $lsmodn) <(ssh www-qa eval $lsmodn)

Diff-able one-liner:

2>&1 nginx -V | tr -- - '\n' | grep _module

Convenient for comparing two environments:

lsmodn="2>&1 nginx -V | tr -- - '\n' | grep _module"
diff -y <(ssh www-prd eval $lsmodn) <(ssh www-qa eval $lsmodn)

EDIT:

Thank you, Roman Newaza, for correctly pointing out that this includes --without module compile flags. I'm not using --without flags and was just focused on getting the module list, so I didn't catch that; the one-liner can be modified to help diff compile flags between 2 installations, like this:

2>&1 nginx -V | tr ' '  '\n'

which is the same as:

2>&1 nginx -V | xargs -n1

Maybe also pipe that through sort to normalize idiosyncratic ordering of compile flags and tr again to split assignments onto diff-able lines. Final result:

lsmodn="2>&1 nginx -V | xargs -n1 | sort | tr = '\n'"
diff -y <(ssh www-prd eval $lsmodn) <(ssh www-qa eval $lsmodn)

That works if sort behaves the same on both remote hosts (ie. they are both GNU or BSD). If you are comparing Linux to BSD (Mac OS X), just move the | sort | tr = '\n' piece out of lsmodn to the local shell where sort will be consistent:

lsmodn="2>&1 nginx -V | xargs -n1"
diff -y <(ssh linux eval $lsmodn | sort | tr = '\n') <(ssh macosx eval $lsmodn  | sort | tr = '\n')

Messier, but it works.

share|improve this answer
    
2>&1 nginx -V | tr -- - '\n' | grep _module command is totally wrong as it lists without-* options as installed! –  Roman Newaza Mar 28 '13 at 9:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.