本篇中,我们会扼要地讨论Apache服务器前端以及怎样列出或查察已经启用的Apache模块。
--AaronKili
本文导航
-查抄启用的Apache模块72%
本篇中,我们会扼要地讨论Apache服务器前端以及怎样列出或查察已经启用的Apache模块。
Apache基于模块化的理念而构建,如许就可以让web管理员添加差别的模块来扩展重要的功能及加强性能[1]。
常见的Apache模块有:
mod_ssl–提供了HTTPS功能。
mod_rewrite–可以用正则表达式匹配url样式,而且利用.htaccess本领[2]来举行透明转发,大概提供HTTP状态码回应。
mod_security–用于掩护Apache免于暴力破解大概DDoS攻击[3]。
mod_status-用于监测Apache的负载及页面统计[4]。
在Linux中apachectl大概apache2ctl用于控制Apache服务器,是Apache的前端。
你可以用下面的下令表现apache2ctl的利用信息:
$apache2ctlhelp
大概
$apachectlhelp
Usage:/usr/sbin/httpd[-Dname][-ddirectory][-ffile]
[-C"directive"][-c"directive"]
[-kstart|restart|graceful|graceful-stop|stop]
[-v][-V][-h][-l][-L][-t][-S]
Options:
-Dname:defineanameforuseindirectives
-ddirectory:specifyanalternateinitialServerRoot
-ffile:specifyanalternateServerConfigFile
-C"directive":processdirectivebeforereadingconfigfiles
-c"directive":processdirectiveafterreadingconfigfiles
-elevel:showstartuperrorsoflevel(seeLogLevel)
-Efile:logstartuperrorstofile
-v:showversionnumber
-V:showcompilesettings
-h:listavailablecommandlineoptions(thispage)
-l:listcompiledinmodules
-L:listavailableconfigurationdirectives
-t-DDUMP_VHOSTS:showparsedsettings(currentlyonlyvhostsettings)
-S:asynonymfor-t-DDUMP_VHOSTS
-t-DDUMP_MODULES:showallloadedmodules
-M:asynonymfor-t-DDUMP_MODULES
-t:runsyntaxcheckforconfigfiles
apache2ctl可以工作在两种模式下,SysVinit模式和直通模式。在SysVinit模式下,apache2ctl用如下的简单的单下令情势:
$apachectlcommand
大概
$apache2ctlcommand
比如要启动并查抄它的状态,运行这两个下令。假如你是平凡用户,利用sudo下令[5]来以root用户权限来运行:
$sudoapache2ctlstart
$sudoapache2ctlstatus
tecmint@TecMint~$sudoapache2ctlstart
AH00558:apache2:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.1.1.Setthe'ServerName'directivegloballytosuppressthismessage
httpd(pid1456)alreadyrunning
tecmint@TecMint~$sudoapache2ctlstatus
ApacheServerStatusforlocalhost(via127.0.0.1)
ServerVersion:Apache/2.4.18(Ubuntu)
ServerMPM:prefork
ServerBuilt:2016-07-14T12:32:26
-------------------------------------------------------------------------------
CurrentTime:Tuesday,15-Nov-201611:47:28IST
RestartTime:Tuesday,15-Nov-201610:21:46IST
ParentServerConfig.Generation:2
ParentServerMPMGeneration:1
Serveruptime:1hour25minutes41seconds
Serverload:0.970.940.77
Totalaccesses:2-TotalTraffic:3kB
CPUUsage:u0s0cu0cs0
.000389requests/sec-0B/second-1536B/request
1requestscurrentlybeingprocessed,4idleworkers
__W__...........................................................
................................................................
......................
ScoreboardKey:
"_"WaitingforConnection,"S"Startingup,"R"ReadingRequest,
"W"SendingReply,"K"Keepalive(read),"D"DNSLookup,
"C"Closingconnection,"L"Logging,"G"Gracefullyfinishing,
"I"Idlecleanupofworker,"."Openslotwithnocurrentprocess
当在直通模式下,apache2ctl可以用下面的语法带上全部Apache的参数:
$apachectl[apache-argument]
$apache2ctl[apache-argument]
可以用下面的下令列出全部的Apache参数:
$apache2help[在基于Debian的体系中]
$httpdhelp[在RHEL的体系中]
查抄启用的Apache模块
因此,为了检测你的Apache服务器启动了哪些模块,在你的发行版中运行得当的下令,-t-DDUMP_MODULES是一个用于表现全部启用的模块的Apache参数:
---------------在基于Debian的体系中---------------
$apache2ctl-t-DDUMP_MODULES
大概
$apache2ctl-M
---------------在RHEL的体系中---------------
$apachectl-t-DDUMP_MODULES
大概
$httpd-M
$apache2ctl-M
[root@tecminthttpd]#apachectl-M
LoadedModules:
core_module(static)
mpm_prefork_module(static)
http_module(static)
so_module(static)
auth_basic_module(shared)
auth_digest_module(shared)
authn_file_module(shared)
authn_alias_module(shared)
authn_anon_module(shared)
authn_dbm_module(shared)
authn_default_module(shared)
authz_host_module(shared)
authz_user_module(shared)
authz_owner_module(shared)
authz_groupfile_module(shared)
authz_dbm_module(shared)
authz_default_module(shared)
ldap_module(shared)
authnz_ldap_module(shared)
include_module(shared)
....
就是如许!在这篇简单的教程中,我们表明了怎样利用Apache前端工具来列出启动的Apache模块。记取你可以在下面的反馈表中给我们留下你的题目大概留言。
via:https://www.tecmint.com/check-apache-modules-enabled
作者:AaronKili[6]译者:geekpi校对:wxy
本文由LCTT[7]原创编译,Linux中国荣誉推出
保举文章
滑动查察更多
输入文章ID或长按二维码直达
[1]:https://www.tecmint.com/apache-performance-tuning/
[2]:https://www.tecmint.com/apache-htaccess-tricks/
[3]:https://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/
[4]:https://www.tecmint.com/monitor-apache-web-server-load-and-page-statistics/
[5]:https://www.tecmint.com/su-vs-sudo-and-how-to-configure-sudo-in-linux/
[6]:https://www.tecmint.com/author/aaronkili/
[7]:https://github.com/LCTT/TranslateProject
我要评论