Apache配置优化策略之第一章查看服务器状态

1.查看当前的运行模块

[root@iZ25ja2kaemZ ~]# httpd -lCompiled in modules: core.c prefork.c http_core.c mod_so.c

2.查看httpd进程数

ps -ef | grep httpd | wc -l

3.查看请求80服务的client ip按照连接数排序

[root@iZ25ja2kaemZ ~]# netstat -nat|grep “:80”|awk ‘{print $5}’ |awk -F: ‘{print $1}’ | sort| uniq -c|sort -nr
257 124.64.16.169 1 100.100.30.25 1 0.0.0.0

4.检测apache的配置文件语法是否正确

[root@iZ25ja2kaemZ ~]# httpd -tSyntax OK[root@iZ25ja2kaemZ ~]# httpd -tSyntax error on line 3 of /etc/httpd/conf/httpd.conf:Invalid command ‘w’, perhaps misspelled or defined by a module not included in the server configuration

5.查看apache的TCP连接状态及并发数

[root@iZ25ja2kaemZ ~]# netstat -tan|awk ‘$4~/:80/{print $NF}’|sort |uniq -c|sort -nr 211 TIME_WAIT 35 FIN_WAIT1 35 ESTABLISHED 1 LISTEN
LAST_ACK 5 (正在等待处理的请求数)
SYN_RECV 30
ESTABLISHED 1597 (正常数据传输状态)
FIN_WAIT1 51
FIN_WAIT2 504
TIME_WAIT 1057 (处理完毕,等待超时结束的请求数)

CLOSED:无连接是活动的或正在进行
LISTEN:服务器在等待进入呼叫
SYN_RECV:一个连接请求已经到达,等待确认
SYN_SENT:应用已经开始,打开一个连接
ESTABLISHED:正常数据传输状态
FIN_WAIT1:应用说它已经完成
FIN_WAIT2:另一边已同意释放
ITMED_WAIT:等待所有分组死掉
CLOSING:两边同时尝试关闭
TIME_WAIT:另一边已初始化一个释放
LAST_ACK:等待所有分组死掉

6.查看apache是否开启了某一个模块

[root@iZ25ja2kaemZ ~]# apachectl -M
Loaded Modules:
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)
log_config_module (shared)
logio_module (shared)
env_module (shared)
ext_filter_module (shared)
mime_magic_module (shared)
expires_module (shared)
deflate_module (shared)
headers_module (shared)
usertrack_module (shared)
setenvif_module (shared)
mime_module (shared)
dav_module (shared)
status_module (shared)
autoindex_module (shared)
info_module (shared)
dav_fs_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
actions_module (shared)
speling_module (shared)
userdir_module (shared)
alias_module (shared)
substitute_module (shared)
rewrite_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_ajp_module (shared)
proxy_connect_module (shared)
cache_module (shared)
suexec_module (shared)
disk_cache_module (shared)
cgi_module (shared)
version_module (shared)
php5_module (shared)
ssl_module (shared)
Syntax OK
[root@iZ25ja2kaemZ ~]# apachectl -M |grep php
php5_module (shared)
Syntax OK
[root@iZ25ja2kaemZ ~]#

发布了11 篇原创文章 · 获赞 0 · 访问量 369
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览