Apache是一个免费的开放式供应程序。它在所有Web服务器上运行67%。它快速,无风险且舒适。它可能是极端定制的,可以通过利用扩展和模块来满足许多同类环境的需求。
要安装apache,请使用以下命令-
$ sudo apt-get update $ sudo apt-get install apache2
apcahe2ctl是Apache超文本交换协议(HTTP)服务器的前端。它旨在帮助管理员控制Apache HTTP守护程序的功能。要获取有关apache2模块的更多信息,请使用以下命令–
$ man apache2ctl or $ apache2ctl -h
样本输出应如下所示–
Usage: /usr/sbin/apache2 [-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 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)
要获取有关在Ubuntu 16.04中启用/加载哪些Apache模块的信息,请使用以下命令-
$ apache2ctl -M
样本输出应如下所示–
[Mon Jan 02 12:04:29.210625 2017] [so:warn] [pid 14538] AH01574: module dav_module is already loaded, skipping Loaded Modules: core_module (static) so_module (static) watchdog_module (static) http_module (static) log_config_module (static) logio_module (static) version_module (static) unixd_module (static) access_compat_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) dav_module (shared) dav_svn_module (shared) authz_svn_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) cgid_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) include_module (shared) mime_module (shared) mpm_prefork_module (shared) negotiation_module (shared) php7_module (shared) rewrite_module (shared) setenvif_module (shared) status_module (shared)
如果要按字母顺序查看列表,请使用以下命令–
$ apachectl -M | sort
样本输出应如下所示–
[Mon Jan 02 12:08:33.025558 2017] [so:warn] [pid 14575] AH01574: module dav_module is already loaded, skipping access_compat_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) authz_svn_module (shared) authz_user_module (shared) autoindex_module (shared) cgid_module (shared) cgi_module (shared) core_module (static) dav_module (shared) dav_svn_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) http_module (static) include_module (shared) Loaded Modules: log_config_module (static) logio_module (static) mime_module (shared) mpm_prefork_module (shared) negotiation_module (shared) php7_module (shared) rewrite_module (shared) setenvif_module (shared) so_module (static) status_module (shared) unixd_module (static) version_module (static) watchdog_module (static)
启用/加载获取Apache模块列表的另一种简单方法,如下所示–
$ apachectl -t -D DUMP_MODULES
样本输出应如下所示–
[Mon Jan 02 12:12:18.015390 2017] [so:warn] [pid 14641] AH01574: module dav_module is already loaded, skipping Loaded Modules: core_module (static) so_module (static) watchdog_module (static) http_module (static) log_config_module (static) logio_module (static) version_module (static) unixd_module (static) access_compat_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) dav_module (shared) dav_svn_module (shared) authz_svn_module (shared) authz_user_module (shared) autoindex_module (shared) cgi_module (shared) cgid_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) include_module (shared) mime_module (shared) mpm_prefork_module (shared) negotiation_module (shared) php7_module (shared) rewrite_module (shared) setenvif_module (shared) status_module (shared)
如果要按字母顺序查看列表,请使用以下命令–
$ apachectl -t -D DUMP_MODULES | sort
样本输出应如下所示–
[Mon Jan 02 12:13:59.845909 2017] [so:warn] [pid 14657] AH01574: module dav_module is already loaded, skipping access_compat_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) authz_svn_module (shared) authz_user_module (shared) autoindex_module (shared) cgid_module (shared) cgi_module (shared) core_module (static) dav_module (shared) dav_svn_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) http_module (static) include_module (shared) Loaded Modules: log_config_module (static) logio_module (static) mime_module (shared) mpm_prefork_module (shared) negotiation_module (shared) php7_module (shared) rewrite_module (shared) setenvif_module (shared) so_module (static) status_module (shared) unixd_module (static) version_module (static) watchdog_module (static)
在以上文章中,我们学习了–了解如何检查Ubuntu 16.04中启用/加载了哪些Apache模块。在我们的下一篇文章中,我们将提出更多基于Linux的技巧。继续阅读!