List loaded modules in Apache web server

One of the tasks that almost every web master need to check form time to time is to list loaded modules in Apache web server, fortunetly standard Apache installation in Linux distributions comes with useful tool called apachectl.

in Debian and Ubuntu you can use the following

apache2ctl -t -D DUMP_MODULES

it will print all loaded modules :

Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 alias_module (shared)
 auth_basic_module (shared)
 authn_file_module (shared)
 authz_default_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cgi_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 php5_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 ssl_module (shared)
 status_module (shared)
 vhost_alias_module (shared)
Syntax OK

 

Please note some Linux distribution uses apachectl instead of apache2ctl

Restarting Apache web server by normal user (non root)

As a web developer I often have to restart apache, memcached and other services on my local or remote machines to do that usually I have to be root or use sudo and type my password to achieve that. lately I found a way to bypass typing the password for specific commands by adding the following lines into /etc/sudoers

{username} ALL = NOPASSWD: /etc/init.d/apache2
{username} ALL = NOPASSWD: /etc/init.d/memcached

by doing this I was able to run /etc/init.d/apache2 restart or /etc/init.d/memcached restart without typing the password.