Linux Apache httpd服务常用命令

Linux系统Apache httpd常用命令

1.查看Apache版本:

# httpd -v
[root@xxxx ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built:   Jun 27 2018 13:48:59

2.查看Apache服务运行状态:

# service httpd status

3.查看Apache httpd进程:

# ps -ef | grep httpd

4.查看Apache服务信息:

# httpd -s
[root@xxxx httpd]#  httpd -S
[Thu Nov 29 10:24:42.110575 2018] [so:warn] [pid 4918] AH01574: module dav_svn_module is already loaded, skipping
[Thu Nov 29 10:24:42.110667 2018] [so:warn] [pid 4918] AH01574: module authz_svn_module is already loaded, skipping
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.1.56.5. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

5.启动Apache服务:

一般apache服务启动的命令:

# service httpd start

如果你的Apache服务是独立安装的,或者安装在其他地方的,这里假设安装目录:“/usr/local/apache-httpd/”,可以去到安装目录启动,命令:

# /usr/local/apache-httpd/bin/apachectl start

还有一种,启动服务时指定使用某个配置文件,命令如下:

# apachectl -f /etc/httpd/httpd.conf 

6.停止Apache服务:

# service httpd stop

去到指定安装目录停止命令:

# /usr/local/apache-httpd/bin/apachectl stop

7.重启Apache服务:

# service httpd restart

同上,去到指定安装目录重启命令:

# /usr/local/apache-httpd/bin/apachectl restart 
posted @ 2018-11-29 11:16  Oliver.Alan-aBlog  阅读(3757)  评论(0编辑  收藏  举报