1. 程式人生 > >Linux Apache httpd服務常用命令

Linux Apache httpd服務常用命令

mod ani read htm entos cache document vhost 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 

Linux Apache httpd服務常用命令