Apache基本操作命令
apache的基本操作命令都在apachectl脚本中,主要是用于控制apache启动,关闭等1. 查询httpd进程
$ ps -aux|grep httpd
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 160750.00.093312 984 ? Ss Sep12 0:00 /opt/taobao/install/httpd/bin/httpd -f /home/admin/lpmall/conf/httpd.conf -k restart
admin 160780.00.1 1141620 2964 ? Sl Sep12 0:00 /opt/taobao/install/httpd/bin/httpd -f /home/admin/lpmall/conf/httpd.conf -k restart
admin 160800.00.1 1207172 3028 ? Sl Sep12 0:00 /opt/taobao/install/httpd/bin/httpd -f /home/admin/lpmall/conf/httpd.conf -k restart
注意:只有一个httpd进程是属于root的,它永远不响应任何用户的请求,而只负责创建httpd子进程,这些子进程才是提供web访问的服务进程。admin是这些子进程的用户名。
2. 结束httpd进程
killall -9 httpd 或者 ./apachectl stop
3. 启动httpd
$ ./apachectl start
/opt/taobao/install/httpd/bin/httpd -f /home/admin/lpmall/conf/httpd.conf -k start
重启则restart
4. 语法检查
$ ./apachectl configtest
Syntax OK
5. graceful
(1) ./apachectl graceful 可以向start一样启动,但是不会中断当前正在处理的请求,也不会关闭日志。推荐使用
(2) ./apachectl graceful-stop 与上类似,但不是所有的apache都支持。
6. status,fullstatus
显示由mod_status提供的状态报告。
7. 使用-f 指定httpd.conf文件
httpd -f /*/conf/httpd.conf
./apachectl脚本中示例:
# the path to your httpd binary, including options if necessary
HTTPD="/opt/taobao/install/httpd/bin/httpd -f $BASE/conf/httpd.conf"
8. apachectl脚本支持的命令
case $ARGV in
start|stop|restart|graceful)
check13
echo "$HTTPD -k $ARGV"
$HTTPD -k $ARGV
ERROR=$?
;;
startssl|sslstart|start-SSL)
check13
$HTTPD -k start -DSSL
ERROR=$?
;;
configtest)
$HTTPD -t
ERROR=$?
;;
status)
checklynx
$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
;;
fullstatus)
checklynx
$LYNX $STATUSURL
;;
*)
$HTTPD $ARGV
ERROR=$?
esac
exit $ERROR
页:
[1]