Linux Apache httpd服务常用命令

Posted Oliver.Alan-aBlog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux Apache httpd服务常用命令相关的知识,希望对你有一定的参考价值。

Linux系统Apache httpd常用命令

1.查看Apache版本:

# httpd -v
[[email protected] ~]# 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
[[email protected] 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 

以上是关于Linux Apache httpd服务常用命令的主要内容,如果未能解决你的问题,请参考以下文章

Linux启动httpd命令?

Linux 中 Apache 的常用配置命令

Centos 下Apache(httpd) 安装过程

Mac中Apache常用命令

Linux下安装配置启动Apache

阿里云linux服务器apache文件夹在哪